get certain animation with script ?

.

This might be what you are looking for.

.

Please format your code accordingly.

Then, if you will, can you post your whole script please.

.

It didn’t work because you are using the “Animator” component, not the “Animation” component. IsPlaying(string name) is a method for the Animation component, which cannot be used with Animator.

.

It’s because the method “IsPlaying” belongs to the Animation class. Animation and Animator are two different classes. You are using “Animator” evidenced by the use of “GetCurrentAnimatorStateInfo”, which is a method belonging to Animator. “IsPlaying” will never work for the Animator class, as it has no definition within it. If you want to use "IsPlaying, you must use the Animation class, which, in my opinion, is a downgrade from using Animator.