Duplicate AnimationController ?

Hello! I have a fighting game with a prefab of a character instantiated twice, one for each opponent, so I can make my tests.

For the animations, I have a unique AnimationController for my two characters. In addition of standard animation states (Idle, Walk, Jump, etc.), I have a another state, for the special hits, and each time a special hit is triggered by the player, I attach its corresponding AnimationClip to the state, via a script. This avoids me to create a state for every special hits of every characters I will create in the future.

So if Player 1 triggers for instance a Hadouken, the Hadouken AnimationClip is associated to the Special Hit state, and then the animation is launched via a trigger variable. If now Player 2 triggers a Shoryuken, I put the Shoryuken AnimationClip in the same Special Hit state, and again launch the animation.

My problem is obvious: if Player 1 AND Player 2 trigger two different hit at the same time, I can’t put two AnimationClips in the same state. My solution would be to create two clones of my AnimationController at the starting of the game, and use these ersatz instead, but I don’t know how to do that. Any idea please? Or maybe I’m using a wrong method with my unique animation state?

Thanks !

Hey Jules,
Not sure you’ll need the answer after that much time but here I go anyway.

The problem comes from the fact that you’re using the same animatorController from two differents characters.

If I were you I would duplicate my animator for each character. I would probably change your method and make multiple states.

I’m sure that at some point some of your character will have different attacks and/or moves than the others.

What you should be doing in that case is to create one animatorController with the typical structure. Then duplicate it and replace all clips for each character.

I’ve done something like that a few months ago.
This asset can help you do that if you have a lot of animation clips : 1

All of this should help you manage different behaviours. Most important it should clean your code a little bit.