- Home /
How do i make my attack function not work whilst animation playing?
I have an attack function and it happens when i left click but i every time i click it applies damage to the enemy whereas the animation still plays once. so if i click 5 times rapidly it will dead 5 lots of damage whereas the animation will only play once or twice. how can i make it work so that i cannot deal damage whilst the animation is playing and have to wait for the next swing?
Answer by Graham-Dunnett · Jul 14, 2014 at 10:00 AM
Set a bool to true when the anim starts playing, and only process mouse clicks while that bool is false. When the anim stops set the bool back to false.
Your answer
![](https://koobas.hobune.stream/wayback/20220613154012im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do i call a function from the child via an animation 0 Answers
Can I make animations snap to a frame? 1 Answer
Calling a function 2 Answers
Call a function dependent on frame of animation? 2 Answers
Animation Event Bug 1 Answer