Unity5.X获取Animator下全部State

        AnimatorController animatorController = _animator.runtimeAnimatorController as AnimatorController;
        AnimatorStateMachine stateMachine = animatorController.layers[0].stateMachine;
        string[] animatorState = new string[stateMachine.states.Length];
        for (int i = 0; i < stateMachine.states.Length; i++)
        {
            animatorState[i] = stateMachine.states[i].state.name;
        }
        return animatorState;

要说点什么呢?好像没的说。就这样吧。

你可能感兴趣的:(unity3d)