- Home /
Mecanim Modular State Handling
Over the past few weeks I've been transitioning our animation handler from using the legacy animation component to using the Mecanim animator. So far things seem to be working really well and I've found just about every solution I need to handle our specific needs. There's just one thing that I haven't found a lot of documentation on, and that's the ability for the player to create animation content and implement it in the game.
I'll try to get a bit more specific. Our game is a pseudo-isometric (using perspective) sci-fi rpg-shooter. One of our features is a large list of weapons the player can use. Most weapons share the same "move sets" which are in general categories (rifle, pistol, sword, dagger, etc). The move set holds information about how the character is supposed to move/reload/draw/holster along with some other important functions. We also have several unique weapons in the game that have their own move sets as well.
The main thing I'm trying to figure out here is the best way to approach implementing this in a modular way. That is to say, create an easy system that allows the player to create custom move sets for their custom weapons and add them in the game.
If I was doing this statically, I would just have all the move sets in one controller and shift between them using different parameters. However, given that the number of move sets and their contents are both dynamic, that just isn't the best way to handle it.
I've done some research on Animation Controller Overrides and that seems to be the best way to go, although it does appear to have some limitations (only able to change the clips and not the behaviors in each state).
What would be 100% optimal for me is if it were possible to load sub-state machines in and out of controllers or controller overrides at runtime. Even being able to blend between animation controllers would be helpful. My main caveat with just having the player create their own controllers is that they would essentially have to duplicate code that is shared between all animators. As any good coder knows, copy pasting code (especially when it's complex code) can very easily lead to disastrous results.
Any ideas? I would really appreciate the help.