Hi,
I have a mouse button event used to detect touch for the iPhone. It basically plays an animation event called “jump”. I just realised that if I click rapidly, it plays the animation from the start over and over. How do I set it in a way that when you press the button, it’ll play the animation once and avoiding any other inputs?
Here’s a snippet:
if (Input.GetMouseButtonDown (0)) //Returns true during the frame the user touches the object
{
if (Physics.Raycast (ray, hit, 100))
{
if(hit.collider.tag == "planeButton")
{
print("Jump");
SpriteAnim.PlayAnim("jump");
}
}
}
Thanks in advance.
-Hakimo
p.s- I remember using a do while or a while loop to implement this but I forgot how to set the condition.