Reusing an Animator Controller for generic animations

Hello,

I’ve been trying to switch to the Mecanim animation system and I ran into a problem, to which I can’t find a solution.

Let’s say, I have 40 objects with animations. They all have different skeletons and animation lengths, but all objects have animations with the same names (e.g. “idle” and “action”). Is there a way to have a single Animator Controller for all of the objects (or maybe something similar)? Or do I have to create a controller for each object separately?

With legacy animations you could have a script, from which you run “idle” or “action” and it would work for all objects (no matter what skeletons or animation lengths they have). I’d like something similar and reusable for generic Mecanim animations.

Thanks in advance!

At the very least, you can use AnimatorOverrideController, but you will still have to fill in the variables:

You can, with Unity Pro, where you can check Sync on state machine layers to have lots of layers with the exact same state machine but with different animation clips, and then you set weight to 0 on the base layer and set the layer that corresponds to the character to weight 1.

Other than that I just know that you can duplicate an Animator Controller, but that’s not quite what you would want.

Hey, I’ve made an asset that can duplicate an animator controller and replace animation clips by new ones at the same time. Perfect if you have multiple character using the same kind of animator structure.

It can also detect changes in durations. Just check it out. I think it could help people with that kind of problem.

Here’s an video where I have multiple characters with the same controller structure: Example

And another one where I show how curves and events are also kept during transfer: Presentation

Thanks guys

I am trying to create a script that auto repopulates an Animation Override Controller - but I can’t seem to “write” to the animationClips property… it just resets.

Help :frowning: