I have some hard times trying to get the current animation state name in Unity, to perform specific actions while I'm in a certain state. I want to know when I'm the "ThoughtsStill" state, I only have the default layer (Base Layer):
To do this, here is what I tried:
AnimatorStateInfo curr_state = _animator.GetCurrentAnimatorStateInfo(0);
if (curr_state.shortNameHash == Animator.StringToHash("ThoughtsStill"))
{
Debug.Log("I'm in ThoughtsStill state").
}
which is not working.
I also tried with IsName()
method but it is not working too (both tried to compare "Base Layer.ThoughtsStill" and "ThoughtsStill").
I'm certain that I'm going in this ThoughtsStill state but I don't know why I can't get it.
Do you guys have any ideas or leads?
Thanks !