Animation (Legacy) vs Animator (New).

So, let me get this straight:


Using Animation Component (Legacy):

animation[clip.name].speed = whatever;

animation.Play(clip.name);

Done.


Using Animator Component (New):

Pass animatorcontroller to animator component.

Pass animation clip to animation state?

Add a “hash” of the “state” of the animation clip file, hash being an integer.

Create a “AnimatorStateInfo” and set to the animator.stateinfo.

Compare animation states instead of game states, by string name (bye bye intellisense), and be sure to remember and include the “layers” of your states (also by string name of course).

animator.SetFloat(“Speed”, value) //Setting vars of animator by string name and type (again, bye bye intellisense).

animator.SetTrigger(animationClipStateHashInt) instead of animation.Play(animationClip.name);

Done. (Probably)


And I haven’t even gotten into the visual animation state editor, but I’m assuming (and hoping) that’s just a way for non-coders to script animations in.

Unity says mecanim (Animator) is supposed to replace the legacy Animation system.

This IS how the new system works, right? The unity docs and tutorials show how to set up the animation system but not how to actually use it (how to simply play a clip). The one tut I found to do this had this ridiculously long process.

How is this an improvement? I can’t do even the most simple of animations now without a ridiculously long, convoluted, and tedius process.

You might be thinking about this from the wrong perspective. The Animator is great for building a whole state machine that doesn’t need any code logic form your side to run. Comparing AnimatorStateInfo, setting speed and layers through code is not necessary, if you use Mecanims features (at least in the majority of cases). But yea, if you only want to play a single clip, continue to use Legacy, it’ll stick around for quite a while and honestly, you can get a free script from the asset store that does the same thing, if Unity ever removes it. For anything that requires States and Transitions, Mecanim will do a great job without much coding. And of course, if you are comfortable scripting your own state machine, you might as well do just that.

Here’s my sample workflow:
Create a new animation for your selected GO (Animator created automatically and all hooked up)
Set states and transitions via parameters/blend trees
Create hashes
Set Params in script.

Doesn’t sound too painful. And if you do need to set all those floats and compare states in your code, you would have to do it anyway when using Legacy, right, so at least it wouldn’t be a step back, I think.

I played around with both systems and for my RTS game Animations turned out to be the more flexible system because you can a lot more with it. Animator is way too static since you can not add animations through scripts which is important for my modding support system - otherwise I probably would prefer Animator instead.

I have been using Legacy with Playmaker and it is really easy. With Animator and Playmaker it is very annoying, long… tedious process.

I also used Animator with Playmaker. Create everything in mecanim and use Playmaker for input controls and binding. Very simple - enjoyable process.

Taking your original example of:

animation[clip.name].speed = whatever;
animation.Play(clip.name);

With the new animator you can do this with 0 lines of code.
Create an attach an AnimatorController onto your object.
Drag in your animation into the controller and set it the speed.
Done.

AnimatorController is far superior.