- Home /
Animation when mouse button is held down?
i want it so that when i click and hold the left button it will keep playing the animation until i let go of the left mouse button here is what i have so far and doesn't work, it will move like a inch and i repeatedly click THEN click by click it plays the animation. function Update () {
if (Input.GetMouseButtonDown(0)){ animation.CrossFade("Shoot Animation"); } }
Answer by Waz · Aug 30, 2011 at 04:26 AM
Use GetMouseButton instead of GetMouseButtonDown, and check that the animation wrap mode is Loop.
And please try to improve the quality of your questions. Formatting your code would help counter your difficulties with writing English.
that just looped my animation so when i click once it play non stop i need it to play the animation on loop but only when my left mouse button is being held down.
Answer by conflictbliz · Aug 30, 2011 at 04:39 AM
function Update ()
{
if (Input.GetMouseButton(0)){ animation.CrossFade("Shoot Animation"); } }
Your answer
Follow this Question
Related Questions
Mouse press animation 1 Answer
Mouse Click Animation 3 Answers
Change Camera on (Right) Mouse Click 1 Answer
OnMouseUp() Click Display Effect. 1 Answer
Unity mouse input gradually becomes off 0 Answers