- Home /
Why is my shoot animation always looping?
The reload animation works when I run out of ammo, but when I click the shoot button (left click) once the animation will loop endlessly. How do I stop this? I've attached two pictures for you guys to check out. Plz help I'm quite new to Unity and I'd really like to carry on :P
Answer by AyAMrau · Sep 07, 2014 at 06:59 PM
You are not setting the Shoot bool on the animator to false except for when the reload happens.
Two solutions depending on design:
You want to play the animation once per click (no continuous shooting)
Use a trigger instead of a bool (it will automatically switch off after triggered) and use time as exit condition for the animation
set the Shoot bool to false from scrip once the animation was triggered
You want to play the animation as long as the button is held:
Check Input.GetButtonUp("Fire1") in a separate condition to set the Shooting bool to false
Your answer
Follow this Question
Related Questions
How can I make my guy stop running? 1 Answer
Animation from a Blender model not looping 1 Answer
Can I make animations snap to a frame? 1 Answer
Only trigger when in specific animation 2 Answers