Reset Animation on Keypress

Hi guys. I’m currently working on a turret that shoots a bullet everytime space is pressed. Everything is working perfectly fine except for the animation.

I would like the animation to reset each time space is pressed so that the turret would seem like it is constantly shooting while the button is being spammed. In the animator, I am currently using a Trigger parameter.

GetComponent().SetTrigger(“WeaponMode2”);

Thanks !

I would use a bool instead of a trigger and set it to true when the user started pressing space using Input.GetButtonDown and let the animation loop (if your animation doesn’t loop you have to select it and check Loop Time). Then, i would check if that the user stoped pressing it with Input.GetButtonUp and set the bool to false. In the animator, i would make two transition, one going in to the animation state with the condition being the bool that i created is true, and one exiting the state when the bool is false.