2D animations - same controller for different characters

Hi,

I have several playable characters, that use the exact state machine for the animations, but the animations themselves are different (different sprites).
I was wondering if there was a way to use a single animation controller for all these characters, instead of duplicating it and changing the “motion” component of each state?

Thanks

Half a year later I can answer my own question. Not sure when this feature was added, but there’s now a Animator Override Controller component which can be created in the project. This allows you to select an animator controller (state machine), and set different animations for each state, but maintain the same transitions and properties.

Neat.

No, I’m pretty sure you need to have a different controller for each animated object. Like you said, each state in a controller is linked to 1 motion/animation slot

No!Different controller for each animated object maybe better!

I watched a brackeys video about animations and I put in a piece of the code and gave me tons of errors. Can you help why this is happening. Here is the code:

if (Input.GetButtonDown("Crouch"))
{
    crouch = true;
} else if (Input.GetButtonUp("Crouch"))
{
    crouch = false;
}