- Home /
Cannot figure out how to find animation in animator by name.
Hello I have a simple onTrigger script attached to an object that when a character touches the collider, a certain animation will play. However not all all characters have that animation and other characters have a similar animation but with a different name that i also want to play.
In my script i want to have something similar to - if animation "dance1" exists in the Animator, play it. otherwise do not play animation "dance1"
The problem is im not sure how to go into the Animator by script and check to make sure a certain animation exists. I can get the animator just fine with
gameObject.GetComponent ();
and I play the animations just fine with
gameObject.GetComponent().Play("dance1");
but I dont know how to check the animator to make sure the animation exists in the first place. Please help!
Your answer
Follow this Question
Related Questions
Animator Controller 2D RPG Best Practices 0 Answers
Animtion looping if joystick is held 0 Answers
Is there a new retargetting system for the animation in 5.5? 1 Answer
Can I play an animation with only 1 image for a duration? 0 Answers
[Solvedf]Animator is not playing an AnimatorController 2 Answers