Search Unity

MouseDown for UI Button

Discussion in 'UGUI & TextMesh Pro' started by FlyingUni, Aug 24, 2014.

  1. FlyingUni

    FlyingUni

    Joined:
    Jul 23, 2013
    Posts:
    2
    I have a situation where I want an event to fire repeatably when the user's finger is "down"... While the PointerDown EventTrigger looked promising, it turns out that it only fires once. I was able to accomplishes this type of behavior previously by simply checking for Input.GetButton("Fire1") in the Update loop.

    Can this be accomplished using the new UI system and Buttons?

    thx
     
  2. Legi

    Legi

    Joined:
    Jul 25, 2013
    Posts:
    20
    You could set a boolean to true OnPointerDown and false OnPointerUp.

    If you check that in the Update loop you get that behavior.
     
  3. FlyingUni

    FlyingUni

    Joined:
    Jul 23, 2013
    Posts:
    2
    Thanks for the suggestion. It just seems weird that with all this cool new UI stuff that I have to write code like this. I get it, very straight forward but my excitement with the new stuff is that a lot of this code goes away... I think there might be a gap here...

    Thanks again for your reply