Mecanim does some things I really like:
- Makes it scary easy to retarget animations to different models.
With Unity 3, I did a lot of my work with the stock character Unity came with, and then when I wanted to use a new character, I had to use all new animations. With Mecanim that isn't a problem, you can simply retarget them. Even though Mixamo claimed their animations didn't work with Mecanim, I didn't have a problem - simply opened them up, selected Rig, targeted humanoid, Apply, done. (EDIT: the Mixamo animations I downloaded from the Asset Store as part of the Action Hero Motion Pack worked, but the ones I get from the Mixamo Store don't. :( Good to know...and you can still get working ones from their website.)
- Lets you chop up your animations, set their loop and pivot points from inside the Unity editor.
In Unity 3, I had to take my jump animation, note at what times in the animation the transitions I cared about happened (crouch to leap; going up to falling down; hitting the ground...), and hardcode that into the script. Plus now you can just click a button and moves the pivot to their feet - which is where I almost always want it.
With Mecanim I just sliced it up into separate clips.
- And the demo has some nice smooth run and idle clips that I like better than the ones I was using. (There were some missing frames in my run. Did anybody notice?) I simply retargeted to my character and they're mine now.
What I don't like so much is the animation state machine I had to create.
Apparently, this will be fixed in a later update - you can't really use Any State as it stands right now, so I've got this mess of transitions of, well, just about any state to any other state, because it's easy to go from jumping to flying - to running (on a wall) - to crouch-running - but then you might stop and just be crouching - and so on.
AFAICT, you can't use mecanim clips in the legacy animation system. So I couldn't just take the new smooth retargeted clips and replace my old animations with them.
And there's still some bugs in my spaghetti system. Surprise. The joys of stateful programming - there's a state in the code representing the character's, well, state, and a state in the animation system, and communicating back and forth provides plenty of opportunities for screwups.
The code, in theory, can tell what state the animation is in with something like this:
AnimatorStateInfo asi = swingAnim.GetNextAnimatorStateInfo(0);
// do NOT forget the space in Base Layer. (I did.)
int jumpFlyHash = Animator.StringToHash( "Base Layer.JumpFly" );
if( asi.nameHash == jumpFlyHash )
lastJumpUpTime = Time.time;
But I was seeing mysterious delays when I used that method to trigger state changes that I never figured out.
One last plus, though - is being able to look at the state graph while the game is running is a pretty cool way to visually debug. You can't do that with Unity 3. Very cool.
Here's what I've done so far: