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
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