|
Post by santourye on Sept 27, 2021 13:46:52 GMT
Hi,
Not sure if it is from the update from the latest version but after updating the package, the scroller in my game is broken. It worked perfectly before.
It uses toggle group, which each cell contains a toggle so that the user can click the a cell and it will toggle off other cells.
These changes break the toggle behavior. Before when i scroll, the toggle will not turn on/off immediately during scrolling, only when directly click on cell. After the change, the toggle will turn off/on to the latest scroll position, which is still ok.
However it also breaks the JumpToIndex function. The toggle turns on and off during this function call, making the behavior erroneous.
I call the JumpToIndex after scroller.ReloadData();
I guess deactivating game object somehow affects it.
// move the GameObject to the recycled container cellView.transform.SetParent(_recycledCellViewContainer); //cellView.transform.SetParent(_recycledCellViewContainer);
// deactivate the cellview (this is more efficient than moving the to a new parent like the above commented lines) cellView.transform.gameObject.SetActive(false); Please take a look and guide me how to fix it. Reverting these lines do make it work. But I would still love some performance gain.
Thanks.
|
|
|
Post by echo17 on Sept 27, 2021 19:21:14 GMT
I'll need to see an example of the issue to be able to diagnose. You can zip up a simplified project that demonstrates the problem and email it to the address in my signature. Please be sure to include steps to reproduce. See this FAQ for more information: linkAlso, you can set the scroller position directly in the ReloadData method, passing a normalized position parameter. This avoids the need to call JumpToDataIndex after the reload, assuming you are jumping immediately without tweening.
|
|
|
Post by santourye on Sept 28, 2021 2:20:34 GMT
Perhaps there is another way so that I dont have to reload the scroller.
When a user presses a toggle cell, it will have an option to unlock the data of that cell. Like buying an item.
Is there anyway to refresh that particular cell only without the need to refresh an entire scroller with ReloadData() ? The cell size remains the same. Only the display inside of the cell is changed (for example: display item ready to buy -> item already bought) When user scrolls up or down back to this cell, it will remain item already bought.
|
|
|
Post by echo17 on Sept 28, 2021 12:18:21 GMT
Check out Demo #7 which shows how to refresh cells without reloading. Reloading is only necessary if the cell size or quantity has changed. Refreshing can update the cell's view without rebuilding the cache of cell positions.
|
|