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

Insight into PyTorch.nn: Parameter vs. Linear vs. Embedding

AWS Account Strategy for every business

[Part 2] How You’ll Become a Software Programmer With No-Code Tools

Popular Flutter Packages in 2021

Cheat Sheets: Machine learning, Python, Visualization, Data Science Libraries, Jupyter Notebook…

Canary Monitoring, part 2

Officer and one of his soldiers tending canaries rescued in the war area. Neulette, 7 May 1918. It might be Second Lieutenant Thomas Aitken, one of the British official photographers on the Western Front.

Generate Auto-Increment id on Azure

How Does Auth Work in a React App with AWS?

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

Loading Scenes In Unity

Setting up a Unity Project for the High Definition Render Pipeline (HDRP)

Level Design in Unity Part 2: The Walls

Using GameDevHQ’s FileBase Asset Database For HQ Models