Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: wallabie on March 10, 2014, 04:51:32 AM
-
I'm trying to figure out how to make the parent Scrollview update itself when one of its children length changes.
Edit: forgot to mention that I was changing the width of the scrollbar in the scene view while the game in playing. I thought that the scrollview would automatically recalculate its bounds when something inside changes.
The last scrollbar at the bottom is the Horizontal ScrollBar for the Scrollview. The other scrollbars are dummy components for the test.
(https://dl.dropboxusercontent.com/u/48378123/ScrollViewNotUpdating.png)
-
Calculating bounds is an expensive operation that causes a fair bit of GC allocation (due to GetComponentsInChildren), and because of this I don't perform this logic at run-time. Only edit time. If you are modifying something at run-time in your game, it's up to you to notify the scroll view that the bounds have changed (via UIScrollView.UpdateScrollbars(true)).