I’m aware similiar questions have been asked dozens of times, but still I wasn’t really able to find a answer for my case…
Basically I have an idle animation and I want a kick animation to play exactly once when I press space. I do not want to make it so that the animator transitions back to the idle animation when the spacebar goes up, I simply want the kick animation to play once when the spacebar goes down.
The problem is now that the kick animation is looping with the code I took from http://unity3d.com/learn/tutorials/modules/beginner/animation/animator-scripting
Animator anim;
int kickHash = Animator.StringToHash("Kick");
void Start ()
{
anim = GetComponent<Animator>();
}
void Update ()
{
if(Input.GetKeyDown(KeyCode.Space)
{
anim.SetTrigger (kickHash);
}
}
I know that in Legacy there is a option to disable looping when you import the animation, but I can’t find the equivalent for humanoid animations…