It might just be me, but the workflow for animation states&properties is a big pain.
When adding lots of similar animations, it takes too long to create a new parameter, create the states, hook up transitions, set transition properties, parameterize transitions, and any other logic that might be needed. For many purposes, I’ve considered using the legacy animation system, as it was much easier to hook up arbitrary, similar animations. I’ve looked for a way to do something similar with mechanim for a long time, but I can’t find any way to play an AnimationClip on some layer at runtime by reference.
I’d like to be able to just play arbitrary animation clips using the Mecanim system. It honestly shouldn’t require someone to hook up a bunch of parameters and animations individually to make them available to play. I’d potentially like to load animations at runtime and play them. It just seems werid that the animation system is so heavily locked down compared to everything else. Even Shaders can be created/compiled at runtime. I could even piece together a bunch of shaders from text snippets. Why can’t I do some similar creation of AnimationController states/machines? Why can’t I swap the AnimationClip on some state from a script? Why does the animation system have to be so relentlessly locked down from being controlled from scripts at runtime? Parameters are too indirect to have good control over animations in many situations, and are not flexible enough to provide easily maintainable solutions (all possible parameters must still be defined in the editor).
I feel like I’ve missed some major API call that’s provided, or sort of trick to making it easier to work with. While I like the power of mecanim, especially the humanoid animation retargeting, from what I can see the interface mechanim exposes is too locked-down. It would be much easier to use, as a programmer, if there were more direct ways to define/control the animations.
Let me clarify with a somewhat hypothetical example:
Lets say I have a bunch of animations in the project, all which would be compatable with a number of different rigs.
Basic movement type animations: Run, Walk, etc
Lots of attack type animations: AttackKnife00, AttackKnife01, AttackKnife02, etc, AttackSword00, AttackSword01,etc, AttackBow00, AttackBow01, etc AttackGreatsword00, AttackGreatsword01, etc, AttackSpellcast00, AttackSpellcast01, etc
And some other, arbitrary animations that might need to be played in a lot of contexts: Emote00, Emote01, Emote02, etc, MiscAction000, MiscAction001, etc
And I want to be able to play some of them on arbitrary animators (for example, through an event system, from a text script written by a designer) which have the supported rig, but don’t want to have to define all of the animations on each controller.
Would there be a way to play an arbitrary animation (provided by data from a text file or something), without having a Mecanim state machine set up specifically to play that animation? It’s fairly easy to look up an AnimationClip by name, so that’s not an issue. Getting the AnimationClip into the Mecanim state machines is the problem, since I can’t do it from script, it has to be set up in the editor, and making sure every controller has 100+ parameters and animations would be very difficult.
The Mechanim state machine can be useful for some cases, but being forced to hook all of the animations up through states makes it very difficult to utilize in certain situations where there would be a large number of states.