Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: devomage on June 10, 2013, 11:19:29 PM

Title: UIDraggablePanel Scrollbar isVisible
Post by: devomage on June 10, 2013, 11:19:29 PM
Where/when is the best place to detect changes in this property?  Fails in both Awake/Start and takes a cycle or two in Update.  Is there possibly an event to subscribe to that i'm overlooking?

Appreciate the best solution.  Thanks!


  1. public UIDraggablePanel mypanel;
  2.  
  3. Debug.Log(mypanel.verticalScrollBar.background.isVisible);
  4. Debug.Log(mypanel.verticalScrollBar.foreground.isVisible);
  5.  
Title: Re: UIDraggablePanel Scrollbar isVisible
Post by: ArenMook on June 10, 2013, 11:30:56 PM
UIWidget.isVisible simply tells you if the widget's alpha is above zero, and the scrollable panel tweens the alpha of the scroll bar to make it fade in -- which is likely why you are seeing a delay.

What are you trying to do?
Title: Re: UIDraggablePanel Scrollbar isVisible
Post by: devomage on June 10, 2013, 11:49:53 PM
The size of my highlight sprite and a couple buttons are conditional if the scrollbar is visible.  I am using 2 different prefabs for the grid rows and disabling the 2 up/down scrollbar buttons.

Title: Re: UIDraggablePanel Scrollbar isVisible
Post by: ArenMook on June 11, 2013, 04:04:55 PM
Why not check UIScrollBar's barSize instead? It will be 1 if the window is able to fit everything, and non-1 if it can't.
Title: Re: UIDraggablePanel Scrollbar isVisible
Post by: devomage on June 11, 2013, 09:38:04 PM
The barSize never returns a value of "1".  See attached screenshot.

  1. Debug.Log("Update = " + mypanel.verticalScrollBar.barSize);
  2.  
Title: Re: UIDraggablePanel Scrollbar isVisible
Post by: ArenMook on June 12, 2013, 03:50:06 AM
Well in your case check for < 0.99 then :P