Author Topic: Separate UI touches from other touch inputs  (Read 3020 times)

iamfeneq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Separate UI touches from other touch inputs
« on: April 16, 2013, 01:38:42 AM »
I'm trying to figure out a way to separate touches in my game. For example, when the user presses an NGUI button, or any gameobject that is using NGUI event system, I want to set a bool in my input manager that disables the cameras panning and zooming capability. Currently you swipe on the screen to pan and pinch to zoom, problem is when I press a button and move my finger the camera starts panning. How might I do something like this? I know how to access components on different game objects that is no issue, I'm more so trying to figure out how/where I would insert some custom code into NGUIs event system that will set this boolean in my input manage to false whenever any ui gameobject is pressed (ya know, without having to enter code and reference my input manager in every single ngui gameobjects OnPressed function). Thanks for any assistance I might receive!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Separate UI touches from other touch inputs
« Reply #1 on: April 16, 2013, 02:01:39 PM »
It's generally a better idea to use only one system -- NGUI's. Keeping two input systems playing nice together is going to give you hair-pulling headaches. With NGUI you have UICamera.genericEventHandler that when set, will receive a copy of all events processed by NGUI. You also have UICamera.fallThrough which receives all events that don't land on NGUI elements.

iamfeneq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 7
    • View Profile
Re: Separate UI touches from other touch inputs
« Reply #2 on: April 16, 2013, 08:22:23 PM »
Beautiful, thanks! Seems to be working great.