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.