Author Topic: Use mouse wheel over a container?  (Read 1707 times)

Zylann

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Use mouse wheel over a container?
« 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?
« Last Edit: August 24, 2016, 10:51:50 AM by Zylann »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Use mouse wheel over a container?
« Reply #1 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.

Zylann

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: Use mouse wheel over a container?
« Reply #2 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.