Author Topic: How to make a collider response click without blocking raycast?  (Read 3123 times)

alexlange

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 34
    • View Profile
Hi, I'm using a red dot to remind people where they click, a collider has been put in front of everything to handle OnPress/OnDrag.
Unfortunately buttons behind it will not be clicked, I'm wondering is that possible to make the collider response without blocking the raycast go through it?

UICamera.fallthrough and UICamera.genericEventHandler seems pretty close to the answer but the former has to be set behind everything, and the latter is obsolete.  ???
« Last Edit: May 22, 2015, 12:15:43 PM by alexlange »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How to make a collider response click without blocking raycast?
« Reply #1 on: May 22, 2015, 04:38:13 PM »
NGUI's events don't go by collider Z. They go by widget depth (assuming the event type is set to UI type).

ALT+SHIFT+W to create a widget, ALT+SHIFT+C to give it a collider, resize to be the desired size. Use that instead of a plain collider.

alexlange

  • Newbie
  • *
  • Thank You
  • -Given: 5
  • -Receive: 0
  • Posts: 34
    • View Profile
Re: How to make a collider response click without blocking raycast?
« Reply #2 on: May 22, 2015, 10:27:31 PM »
NGUI's events don't go by collider Z. They go by widget depth (assuming the event type is set to UI type).

ALT+SHIFT+W to create a widget, ALT+SHIFT+C to give it a collider, resize to be the desired size. Use that instead of a plain collider.

Is that possible to make a button behind another also response the click(same position but different widget depth)?

UPDATE:
Asset like EasyTouch is an easy way to handle complex touch events and it's compatible with NGUI :)
« Last Edit: May 22, 2015, 11:53:06 PM by alexlange »