Author Topic: Best way to consume/block NGUI touches activating Input.touches elsewhere?  (Read 2217 times)

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
In a game with a touch based waypoint movement interface using Input.touch, pressing an NGUI button also registers as a touch to the screen position underneath. What's the best way to prevent touches on NGUI widgets registering as touches elsewhere? The only obvious way I can think of is a check for each touch against the coordinates of all controls.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Best way is to use NGUI's event system instead of going directly to Unity via Input.GetTouch. NGUI already does all the GetTouch etc logic for you -- so use it. Set UICamera's fallThrough to some game object that will have your custom script on it, then listen to OnPress / OnDrag events.