Get the Animation Clip Of An Animator State and Rename The State To the Name of the Clip

I’ve been doing this manually myself so I was wondering if it’s possible to automate this.

Loop through all the animations OR animation clips of an Animator and rename the state to it’s clip.

There’s probably a way to access that through editor scripting. What have you found in the docs so far?

Nothing at the moment in regards to getting the state of an animation or the animation of a state. I’ve only found ways to get their info individually.

code for inside an editor script

  AnimatorController animController = animator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController;
        foreach (var s in animController.layers[0].stateMachine.states)
        {
            s.state.name = s.state.motion.name;
        }

Thanks. Does this just capture a single pose or the whole sequence and how does one export this?