Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: Zylann on August 24, 2016, 09:52:07 AM

Title: Use mouse wheel over a container?
Post by: Zylann on August 24, 2016, 09:52:07 AM
I have a background widget and other widgets inside it (buttons, text boxes etc).

I want to be able to use the scrollbar over all this, but it doesn't works because widget colliders are above the background collider.
Also, I cannot rely on hierarchy because widgets are siblings of the background, not children.

Is there a way to be able to handle the mouse wheel above the area covered by the background?
Title: Re: Use mouse wheel over a container?
Post by: ArenMook on August 24, 2016, 02:47:30 PM
You need to use a scroll view.

Keep your background, but put a scroll view, with all other widgets going inside it, not inside your background widget.
Title: Re: Use mouse wheel over a container?
Post by: Zylann on August 25, 2016, 09:33:33 AM
I couldn't use a scroll view due to my requirements, I cannot have a UIPanel and the scrolling isn't really a classic one.
I ended up putting a custom script on all elements having a collider and made them send the scroll event to the scrolling handler.