-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A bug that dynamically adds Cells in GridLayout that does not show Cells in certain situations #178
Comments
Hi, Thanks for detail report! This is a common API misusage:
so the test code should be like: private float elapsedTime = 0;
private void Update()
{
elapsedTime += Time.deltaTime;
if (totalCount < 50 && elapsedTime >= 0.1f)
{
elapsedTime = 0;
totalCount++;
var scrollRect = GetComponent<LoopScrollRect>();
scrollRect.totalCount = totalCount;
float offset;
var start = scrollRect.GetFirstItem(out offset);
scrollRect.RefillCells(start, offset);
}
} This refills cells while keeping the first item and offset visually nochange. |
Thank you for your reply! I was referring to the "UI_ControlData.OnButtonAddDataClick" demo code.
Anyway, I would like to add new items (=new data) at the end of the scroll in very short time intervals. However, the "RefillCells" function returns all the items you are currently seeing to the Pool and gets them again, calling the "ProvideData" function of all the items again. Just to give you an example of my situation, I have about 60 items that can be seen in scrolling (there's a lot more data) and I add one every 0.02 seconds. Then it works like below. 0.02 seconds -> Call the first item "ProvideData" All I'm looking forward to is adding a new item at the end, only the "ProvideData" function of the last item needs to be called. I would appreciate it if you could tell me if there was anything I misunderstood or any other solution. And I'm sorry for my clumsy English. |
Hi, The use case you provided is quite practicable so I fixed with GridLayout may increase totalCount at any time, so fill last row when possible. BTW, even through pool operations are skipped with LoopScrollRectDev.-.DemoScene.-.Windows.Mac.Linux.-.Unity.2021.3.33f1.Personal_._DX11_.2024-09-07.16-29-53.mp4 |
Hello. I'd like to ask you about two issues.
_2024_08_06_21_37_22_211.mp4
_2024_08_06_21_38_02_894.mp4
The text was updated successfully, but these errors were encountered: