Author Topic: How can I detect clicking(touch) event??  (Read 4242 times)

hmnyari

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 29
    • View Profile
How can I detect clicking(touch) event??
« on: June 12, 2013, 03:16:10 AM »
I want to detect touch event

UiButtonMessage has [OnMouseOver] event but this event not work at mobile

and[ OnPress ] call method only 1 time.

I want to call method every frame when Pressing button. not one time.

How can I do? 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: How can I detect clicking(touch) event??
« Reply #1 on: June 12, 2013, 04:24:39 AM »
OnMouseOver is a Unity's built-in event for colliders and should not be used.

NGUI has OnHover (bool isOver).

Furthermore, there is no "hover" on mobiles. How would you detect your finger hovering over a button? You can't.

Instead in OnPress(true) set a boolean flag declared within your class. Check this flag in Update() and call your logic repeatedly.

hmnyari

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: How can I detect clicking(touch) event??
« Reply #2 on: June 13, 2013, 02:14:32 AM »
Thank you ArenMook  :)