In C#, how would I get the number of animations in an Animator Controller?
So I want to find out how many animations there are in an Animator Controller, and have this number in script.
Thanks in advance!
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
If you are using Version 5 and up, you can get all states in the Animation Controller. You will need to drill down to layer, state-machine and then finally state.
Follow these to get started:
http://docs.unity3d.com/ScriptReference/Animations.AnimatorController.html http://docs.unity3d.com/ScriptReference/Animations.AnimatorController-layers.html http://docs.unity3d.com/ScriptReference/Animations.AnimatorControllerLayer-stateMachine.html http://docs.unity3d.com/ScriptReference/Animations.AnimatorStateMachine.html