Author Topic: Solution for hoveredObject on actual devices?  (Read 2669 times)

fwalker

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 15
    • View Profile
Solution for hoveredObject on actual devices?
« on: December 27, 2013, 08:58:15 PM »
Hi,

I have seen a couple of post on this but not a definitive answer. I use UICamera.hoveredObject check to stop processing any input if the input has taken place over a NGUI object.

But, as others pointed out, the UICamera.hoveredObject does not work on the actual devices (due to a lack of mouse) and the multi touch issue?

So what can I use instead?

The functionality I want is literary that. If the user is clicking over a NGUI object then I don't want essentially my game objects to process any inputs.

So I have this at the beginning of my HandleInput method

if(UICamera.hoveredObject != UICamera.fallThrough )
{
  return;
}

This works beautifully in PC and Mac.

Please help !

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Solution for hoveredObject on actual devices?
« Reply #1 on: December 28, 2013, 02:09:53 AM »
Best thing? Use NGUI events to start with. Don't process Input events yourself. NGUI does a full range of events for you -- press, click, drag (move), drag enter / exit, etc.

Keep in mind that fallThrough object will be receiving all those NGUI events if nothing else does.

If you can't do that, you might need to expose UICamera.mTouches so you can loop through them yourself... but I wouldn't advise it.