- Home /
Fill in Sprites/Animations at runtime for Mecanim & State machines
I'm creating a 2D wrestling game. There are going to be 10 or more characters with exactly same states like walking, running, idle, jumping etc and same sprite names. I'm not sure but It's logical to make a single State Machine for all characters and assign the sprites and animations to state machine at run time. Whatever character the player will choose, the state machine would automatically pick the character's sprites/animations and start working. If there are 4 players, then state machine would duplicate? This seems logical to me rather than creating 10(or more in future) different state machines for all the characters. This way i could just drop in a new character without having to alter the animator or state machine. I'm not sure if this is a good idea or not but i need some help approaching it. I'm not sure if this is possible in Unity. I know how to make static animations/state machines but I've done never this using scripting. Any other help or tips would be greatly appreciated. Some starting code would help.