Using the Unity Animation System

Objective: Adding the animations to a model

Jean-Noel Seneque
3 min readAug 26, 2021

In the previous article, Working with Unity’s NavMesh System for Smart AI, we saw how to move a model using a waypoint system and the NavMesh Agent. In this article, we are going to animate the model instead of it sliding around.

To start, the model needs an Animator component added.

We need to create an Animator Controller and drag it into the Animator Component.

Double click on the GuardAC Animator Controller will open the Animator window.

In this example, I will drag on the Idle and WalkingAlert Animations, set the transition from the Idle to WalkingAlerted and back again.

Next, I am going to create a Bool parameter that will control when the animator controller transitions between the two animations.

Now let’s make use of this parameter in the transition. Notice we unchecked Has Exit Time.

Do the same for the transition from WalkingAlert to Idle but set the Walk condition to false.

Now, all we need to do is call the animator in the script and set the Walk parameter at the right moments when the guard is moving during the waypoints and set it to Idle when pausing at the endpoints.

As you can see below, the model now switches between the Idle and Walk animations.

If you enjoyed reading this article give me a Clap, also if you would like to see more, “Follow” me, so you may be notified of future releases. You may also send me a message if you need any further help.

--

--

Jean-Noel Seneque
Jean-Noel Seneque

Written by Jean-Noel Seneque

A Data & Analytics Consultant who is expanding into developing experiences in XR, Enterprise and Gaming space using Unity www.jeannoelseneque.com

No responses yet