- Home /
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.
Answer by dkozar · Jan 05, 2013 at 09:20 PM
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).