How to check if animation is playing? C#

hi all!

i’m having trouble here…

i’m trying to figure out if a specific animation is playing or not in the Animator, and if its not, then do something.

I also am trying to do it from a script that isnt attached to the animated geometry.

this is what I have but I cant get it working:

//in public class Other : MonoBehaviour {
 Animator anim;


//in an IEnumerator
if(anim.animator.GetCurrentAnimatorStateInfo(0).IsName("Idle")){
    print("IDLE IS PLAYING");
}


//in void Start ()
player = GameObject.Find("Character");
anim = player.GetComponent<Animator>();

can anyone help me with some code that works?

thanks heaps!

:slight_smile:

(anim.animator.Get ETC

Drop the ‘animator’ and you are on to a winner.