Set speed of all animation states in a single sub state machine or layer?

Hey all, I must be blind but I cannot figure out how to get all the animation states of a sub state machine.

There’s Animator.speed which doesn’t work, since that would also slow down the base layer which controls walking and running (which is allowed during some character actions and some casting animations).

Setting AnimationState.speed seems like the perfect solution, but so far none of the Animator’s public methods seem able to return animation states?

The Animation component seems to let one loop through every single state machine attached to that animation, but I also can’t see where or how I can get an “Animation” from an “Animator”. My Animator is attached to the player game object.

Would really appreciate some help here - I need to be able to speed up or slow down animations based on the characters move, attack, and cast speed and I have different layers dedicated to each of those tasks.

Thanks!

But of course, the moment I post a question I find an answer to my problems.

As discussed here: I can just use a parameter and use it as a multiplier of each specific state.

This is exactly what I needed!

AnimationState and the Animation component are from the legacy animation system.

Using a multiplier parameter is the correct way to do it in an Animator Controller.

1 Like