LoopScrollRect
LoopScrollRect copied to clipboard
These scripts will make your UGUI ScrollRect reusing cells, to improve performance, loading time and draw calls.
Hello. I'd like to ask you about two issues. 1. GridLayoutGroup is adding cells over time. If the cells overlap the Viewport size here, the second cell from that line...
[20240621-154615-bug.txt](https://github.com/user-attachments/files/15924482/20240621-154615-bug.txt) 这个是日志输出文件 当选中绑定的那个Scroll脚本的时候,就会出现。 很容易出现
大佬你好,我现在在用这份插件制作无限循环列表,发现: 1. 没有输入Index获取item的接口,也没有找到itemList这样的结构,请问如何定义这个接口? 2. 我现在要做点击Item后让它移动到ViewPort中间位置,尝试修改ScrollToCell无果,请问该怎么修改可以达到目的? 3. 我现在要实现滑动列表时,自动将ViewPort中间Item长宽范围高亮,脱离这个中间范围就取消高亮,达到类似手机上滚动时钟或者老虎机那样的效果,请问我该怎么检测item是否达到了ViewPort中间范围,或者有没有更佳的建议可以提供呢?
请求帮助
你好,现在在我的Content中,我的第一个item是独特的,它只显示在Content中的第一个(显示在滑动条的最上方)。它下面跟着其他样式一样的item,滑动时第一个独特的item和其他item都会一起滑动;使用你的插件,每滑动一个循环第一个独特的item会重复出现,怎么修改能实现我需要的功能呢
目前对比了一下Demo提供案例 在创建的地方修改了这些参数,似乎好了 layoutGroup.childForceExpandWidth = false; layoutGroup.childForceExpandHeight = false; layoutGroup.childControlHeight = true; layoutGroup.childControlWidth = true;
在提交[https://github.com/qiankanglai/LoopScrollRect/commit/629112ce5cb5afcc9214753e830597e961042013](url)中,将`UpdateBounds()`放在`OnRectTransformDimensionsChange()`方法中调用,我将这次提交合并到我们的项目中,发生了严重bug。原因在于,`UpdateBounds()`最终会引起ClearTempPool()->prefabSource.ReturnObject()`的调用,而`prefabSource`在没有初始化时为空,具体错误日志如下: ``` NullReferenceException: Object reference not set to an instance of an object UnityEngine.UI.LoopScrollRect.ClearTempPool () (at Assets/Plugins/CustomUGUI/LoopScrollRect/Runtime/LoopScrollRect.cs:61) UnityEngine.UI.LoopVerticalScrollRect.UpdateItems (UnityEngine.Bounds& viewBounds, UnityEngine.Bounds& contentBounds) (at Assets/Plugins/CustomUGUI/LoopScrollRect/Runtime/LoopVerticalScrollRect.cs:178) UnityEngine.UI.LoopScrollRectBase.UpdateBounds (System.Boolean updateItems) (at Assets/Plugins/CustomUGUI/LoopScrollRect/Runtime/LoopScrollRectBase.cs:2181) UnityEngine.UI.LoopScrollRectBase.OnRectTransformDimensionsChange...
 如图这个函数在lateupdate里一直在确认画布重建,但是一直在调,我没细看代码,重建后是否需要设置一下状态
由于本身LoopScrollRect的接口暴露相对底层,实际项目用起来普遍需要一定二次封装;同时有些接口(譬如`RefillCells`、`RefreshCell`)区分度不够清晰,容易引起误用。 这里先整理下常见项目用法,初期以sample形式提供参考、等稳定之后提供到LoopScrollRect内。 - [issue #170](https://github.com/qiankanglai/LoopScrollRect/issues/170#issuecomment-2642191680): `ScrollToCell` 移动到中间、上边或者移动到可视范围内 - [issue #186](https://github.com/qiankanglai/LoopScrollRect/issues/186#issuecomment-2642386062) : 统一刷新逻辑+当totalCount变化时,尽量保持元素固定