Using Unitys Animation System

Esteban Ibarra
3 min readJun 5, 2021

We’ve actually covered Unitys animation system in the Galaxy Shooter, but now we’ll be using these familiar tools in a 3D Environment and happily, they work exactly the same.

In this case, we’re given a prefab of Darren, our thief protagonist. I’ve replaced the capsule with him so now we need to give him the components to make him animatedly. First, we’ll create an animator controller and call it Darren.

Next we’ll open up the animator window and put in all his current animations, making sure Idle is first so it’s his default state.

Right now, we can’t see these animations yet, we have to put an animator on the Darren model itself:

Once the animator is in, we drag the animator controller we created originally into its slot.

If we hit play, Darren should automatically be playing his idle animation. This will validate we implemented our animator components successfully.

Next, we’ll quickly hook up our walk animation to see him stealthily move around!

We’ll make transitions from idle to walk and vice versa. Next we’ll need a condition on how these transitions will be allowed. We’ll use a boolean called isWalking.

Next, click on the arrow going from idle to walk. We’ll add a condition of the boolean ‘isWalking’ needing to be true in order for it to activate.

Logically, we’ll need ‘isWalking’ to be false when transitioning back to idle.

Just a quick note, be sure to turn off ‘has exit time’ on each transition, this will prevent any lag in the animation playing when it needs to.

While we can programmatically control the animations, we can quickly test to see if our animation transitions are working by hitting play and then clicking on the isWalking parameter in the animator window:

Pretty awesome! Tomorrow we’ll integrate it into our Player script!

--

--