【Unity Tutorial】How to use the AnimatorController

Unity has a function called Animatorcontroller, which is used to implement animation effects for characters and 3D models.

AnimatorController controls multiple animation clips, and by using this function, you can switch animation clips, and combine different animations.

AnimatorController Settings

In this article, I am going to introduce how to use AnimatorController through a tutorial to create a rotating cube animation.


Be aware that you need basic knowledge about the animation function beforehand, so if you haven’t read this ‘[Introduction to Unity] Learn Animation system’ article yet, please read it first.

Open the AnimatorController

As preparation, please create a Cube.

You can keep the settings as default.

Create a Cube

First, go to the Project view and select「Create」→「Animator Controller」.

Creating an animation controller in the Project view

A new file is created in the Assets folder. This is the AnimatorController file.

For this tutorial, I want to create an animation where the object simply rotates, so please change the AnimatorController’s name to ‘Rotate’.

The created AnimatorController

Double click the AnimatorController file, then a Animator settings window will popup in the Scene.

Animator settings

Creating an Animation

Let’s create a Rotate animation then.

In the Project view, right click and select「Create」→「Animation」.

Create an Animation clip

An animation clip will be created in the Assets folder, so change the file name to ‘Cube Rotate’, and drag and drop the file into the Cube’s Inspector window.

This procedure is needed because the file does not work on it’s own, it needs to be attached to the object it affects (The Cube).

Adding an animation by drag and drop

An animation has been added to the Cube’s Inspector window.

Animation added to the Inspector

But although the animation is set to the Cube object, the animation is still empty now.

So we need to add a rotation movement to the animation.

Click the Window menu, select Animation, and open the Animation view.

Animation view

In the Animation view, select「Add Property」→「Transform」→「Rotation」, and click the + button.


Add properties to Rotate

As in the image below, a timeline will be displayed, so change the keyframe value of Rotation.y 1:00 to 360.

Settings to rotate once every second around the Y-axis

This settings makes the Cube rotate once (for 360 degrees) around the Y-axis every second.

Run the Scene.

The Cube rotates only once

As planned, the Cube rotated once around the Y-axis. But the animation stops after one rotation.(The above is a GIF image, so it will rotate continuously)

Create a State

Next, I will explain how to use the AnimatorController.

Right click in the Animator window, and select「Create State」→「Empty」.

Select Empty

A rectangle called ‘New State’ has been created.

New State is created

The rectangles in the Animator window are ‘States’, including ‘New State’.

A State is a function that can store and set settings to animation clips. By adjusting the settings of a State, you can edit the animation settings.

Currently, a arrow is emerging from the ‘Entry’ State and heading towards the ‘New State’ State. This arrow is called a Transition.

A transition is used to set the execute order of animations, so in the above image, the ‘Entry’ animation runs first, then the ‘New State’ animation.

Role of each State

Now, I will explain the basic roles of each default State.


The Entry State is the first State that is called, and the transition happens from here.

You need to set a transition from Entry to the animation you want to run first.


Any State

The Any State is a State that can transition from any State to any State.

Any State

So, if you set a transition as in the image below, you can set any transitions you want to.

Any transitions can be set


If you transition to the Exit State, the transition returns to the Entry State.


So, if you set the last transition to the Exit State, you can loop your animations.

How to use AnimatorController

Once we have learned about each State, let’s select the ‘New State’ we created in the previous step and change the name to ‘Cube Rotate’.

Changing the State name

Looping the Animation

Next, let’s set a loop to the animation by editing the State settings.

Right click the ‘Cube Rotate’ State, and then click ‘Make Transition’.

Select Make Transition

A white arrow will emerge, so attach it to the ‘Exit’ State.

Transition to the Exit State

The transition returns to the Entry State after the Exit State, so the animation will loop with this setting.

Run the Scene and check the animation.

Looping Rotate animation

You can see the animation is looping now.


In order to explain how to set an animation in Unity, I made a very simple tutorial for this article.

Even if an animation that looks complicated, it is just that there are many objects included, or movements are set in detail.

I want to introduce more advanced uses of the AnimatorController, but there isn’t any more space, so that is it for this article. I hope you look forward to my next article!