- Home /
Check if animation name exists in Animator Controller before requesting to play?
I want a way to check if an animation exists in the Animator Controller before playing.
Example: Animator mController; if ( mController contains "animationName" ) { mController.Play("animationName"); }
I've tried looking for a solution but haven't been able to find one. I know how to check the name of the animation that is currently playing but not others than the controller is holding.
Answer by AcE_fLoOdEr · Jan 04, 2015 at 11:41 PM
The pseudocode you wrote isn't going to work because the Animator is not the controller. It holds the controller, but the controller is different.
I just checked the definitions available for Animator (knew it wasn't going to work anyways) and the RuntimeAnimatorController, which is the controller itself. No definition for checking the animations within.
Your answer