- Home /
Shoot only when animation is playing?
In my game the player shoots a bullet after 1 second from when i press the button, and the the 1 second is the time the animation is playing and his hand is in the air. But sometimes the animation doesnt play and the bullet is shot anyways. Can anyone help me with this paroblem.
Answer by Jakeiiii · Sep 09, 2015 at 09:58 AM
Make sure that the transition to the animation is instant; and have the animation trigger the line after you have the bullet shoot. To make sure an animation transition is instant: -select the transition arrow in the Animator Window; -in the top right of the inspector there is an icon with a down-arrow next to 3 horizontal lines, click it; -select Debug from the list that drops down (you can set it back to normal after); -in 'Transition Duration', change the field to zero.
Also check to see if the animation it's transitioning FROM doesn't have an exit time.
Your answer
![](https://koobas.hobune.stream/wayback/20220612033031im_/https://answers.unity.com/themes/thub/images/avi.jpg)