knowing when a ScrollView's scrollbar is focused

Hi.

I am implementing a GUI in which a certain window contains a Scrollview with its respective scrollbar. The window fades out after certain amount of time, and if it fades out when the user is focusing the scrollbar (i.e moving the ScrollView around), the input is “locked” and the rest of the game stops receiving mouse clicks.

I’d like to know if there’s a way of knowing when the scrollbar is being used so as to prevent the window to fade out then OR any other solution to my problem would be OK.

Unity Answers: knowing when a ScrollView's scrollbar is focused - Questions & Answers - Unity Discussions

There’s no such notification by Unity Engine. What you have to do is keeping the list of components (Rects) and track the last mouse-overed one (at least I did it this way with eDriven).

As for a dirty fix, you could possibly track the last time the scrollbar has been scrolled, and after a few seconds of inactivity, you could probably force the ‘focus out’ to happen (using GUI.FocusControl).

thanks dkozar! I’ve done something like that. I still get a very rare bug where if the user is holding down the scrollbar with the mouse outside the scrollbar’s rectangle, and the timeout occurs, the whole game freezes… O.o

I don’t know… maybe I’ll just wait for the NEW Unity 4 GUI system… :frowning: