Author Topic: Scrollview not updating when child scrollbar length is changed.  (Read 1373 times)

wallabie

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 200
    • View Profile
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.

« Last Edit: March 10, 2014, 06:54:21 AM by wallabie »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollview not updating when child scrollbar length is changed.
« Reply #1 on: March 10, 2014, 09:06:42 PM »
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)).