- Home /
Ignore mouse click while animation plays?
I have 2 animations of a right fist and left fist punching. Left click is left fist, and right the opposite.
How would make the punch animation keep playing even if you click another mouse button? Currently if you tap left and right fast it plays just the start of each animation and he attacks really fast.
Answer by jacksmash2012 · Jun 28, 2012 at 04:26 PM
You can always check if the animation is playing using:
Animation.IsPlaying()
So, for example, you could have a function that sets a flag based on which animation is playing:
bool flag;
void Update()
{
if (myAnimation.IsPlaying())
flag = true;
else
flag = false;
if (!flag && Input....)
// play the appropriate animation
}
Doesn't necessarily need to happen in the Update function, but this is just an example.
Your answer

Follow this Question
Related Questions
disable mmb and rmb raycast on ColorPicker 0 Answers
LookAt mouse, with run animation 1 Answer
Can I make animations snap to a frame? 1 Answer
disable script when i press escape?? 2 Answers