- Home /
Question by
JeffreyRocks · Sep 26, 2021 at 03:09 PM ·
animatortrigger
With settrigger the animation keeps looping
I have an attack animation that needs to play once when i press spacebar.
if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log("space");
animator.SetTrigger("Attack");
According to the documentation the animation should play once. But it keeps looping why?
https://docs.unity3d.com/ScriptReference/Animator.SetTrigger.html
Comment
Answer by Scared-Crow-Games · Sep 26, 2021 at 03:52 PM
Try to uncheck "Loop Time" of your animation clip. Setting a trigger causes a one-time state change and does not affect how many times the animation plays.
screenshot-1.png
(8.2 kB)