Last active
August 29, 2015 14:16
-
-
Save quickfingers/421b32aaf99ccba70ee7 to your computer and use it in GitHub Desktop.
Getting a list of mecanim states in Animator 4.3+
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UnityEditorInternal.AnimatorController ac = GetComponent<Animator>().runtimeAnimatorController as UnityEditorInternal.AnimatorController; | |
| UnityEditorInternal.StateMachine sm = ac.GetLayer(0).stateMachine; | |
| for (int i = 0; i < sm.stateCount; i++) | |
| { | |
| UnityEditorInternal.State state = sm.GetState(i); | |
| Debug.Log(string.Format("State: {0}", state.uniqueName)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment