What is the Animation Now?- Game Dev Series 103

Quick guide: check Animator state to proceed code.

So far we controlled Animator from Player movement for many times. And what if we want to control the movement from Animator? Like stop walking when Animator state into Idle, and walking when transition to Walk state.
We can easily do this part by using the default bool of Animator reference.

Get current state of Animator

To do this part, we will need to use Animator.GetCurrentAnimatorStateInfo().

It requires the layer integer of Animator, which is 0 on base layer by default.

In my case, if I want to make it check the state is “Idle” or not, use it like this:

I can simply add this line before the Player movement method to prevent the code proceed.

It will continue the following script when Idle is finished playing.

And that is how to check the state of Animator.

--

--

--

A passionate gamer whose goal is to work in video game development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Project Apex Tracker

Top Webflow Websites — #3

How to get started with Load Testing?

How to Raise Audio Quality Using a PyTorch Implementation of NU-Wave on WSL2

DOCKER GUIDE: HOW TO INSTALL DOCKER AND WRITE DOCKERFILES

Why learn algorithms?

Why we write WebDriver driver = new ChromeDriver(); in Selenium Web Driver?

AngelHack Manila 2018 Experience

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Day 105: Working with Animation Events in Unity

Building a Custom Cinemachine Virtual Camera Zoom Feature with One Button in Unity

Working with Cinemachine

How I used scriptable objects to build a powerup system