In Unity 5

Animation in Unity is one of those love / hate relationships.  I personally think it fits better in 3D, though you can use animation for both types of games.

To start, we’ll need to create the appropriate animation objects.  Those objects are an animator controller and an animation.  Animator controller can short hand down to just animator for the purposes of this tutorial.


Creating your animation and animator objects is simple enough.  Just right click in the project view and go to the create tab to make some blank templates.

It may be useful to open up the animator and animation windows via the window tab.  I usually do so and drag them into the list of tabs next to my scene view and game view.  We’re going to take a look at each one of them.


Before we look into animations, let’s take a look at a possible animator controller.  When you open up your animator, it will not look exactly like this.  Instead, you’ll just see the entry and any state nodes.  That’s normal.

However, you can take your animation and drag it into this view to create a node based on that object.  You may notice the first time you do this that the new node is orange.  That means it’s the default animation.  It’s the one that plays first when your object is created in scene view.  As such, you’ll usually want the default to be an idle animation.

Don’t worry if you loaded the wrong one.  Right clock on a gray node and set it to default.  The new node will turn orange and the old one will turn gray.


Right clicking on a node has another purpose.  That purpose is making a connection to another node.  Unity prides itself on seamless transitions between 3D animations.  The following process is less important for 2D animations, but it’s the standard across both genres.

When you create a connection to another node, then the animation will transition to the new one at the end of it’s sequence.

However, and this is a big however … if you happen to set conditions, then that node will transition as soon as those conditions are met.

Conditions rely on parameters.  Setting up a condition is easy.  You can either check if a parameter is greater than, less than, true or false, etc.  Parameters are set up on the left side.  Click the icon to add a new parameter.  In this case, I added the speed parameter, which is useful for transitioning between walk and run.

The following piece of code will make my character transition to the run animation.



The great thing about animations and animator controllers is that most assets you download from the Unity Asset Store will come with pre-packaged animations.  You won’t have to go and animate them through a program like maya or blender, which is nice.

I won’t tell you how to set up model animations in Unity, partly because that is massively complicated and time consuming.  For 2D animations, you take a sprite sheet set to multiple and cut into pieces.  Then, you drag a set of them into the hierarchy and boom.  Instant animation and animator controller generated.

That’s all I have to say today.  See you next time on the next tutorial.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s