Check if animator animation is playing

So i need to disable and AI and Player ability if an animator animation is playing. Previously i solved this by using animation GetComponent().isPlaying(); but as this is deprecated in 2017.1 version of unity (Unity - Scripting API: Component.animation) i would not like to use that solution.

I’ve tried to use different functions from here (Unity - Scripting API: Animator)
but none of which gives the wanted behaviour.

Managed to solve this by myself:

In the Animator controller I just added a transition from the Animation back to the default Animator state.

Then i just set a tag for all animations I wanted to check for (tag=“1”) and checked with:


Which returns true if animation is playing, otherwise false

i understand I am late but I thought I should not leave this question a question for others who are looking for the same answer. The picture shows where to set tag for animations.