The animation state could not be played because it couldn't be found!

Hi,

So, I have a few animations that get triggered based on if/else statements, but I always get messages like, “The animation state attack could not be played because it couldn’t be found!”
Please attach an animation clip with the name ‘attack’ or call this function only for existing animations.
UnityEngine.Animation:CrossFade(String)

Here is an example of code:

if(distance < pursueDistance)
    {
    animation.CrossFade("walk"); 
    } 

I don’t understand what the problem is. I deleted the animations and reloaded them, but that didn’t help. Any ideas on how to fix this would be appreciated.

Thank you!

I have this problem , and i think i find the solution . select your player , then in the inspector area clik on “select” and know clik on “Rig” and in the Animation type choose "Legacy ". for me that work hope it will work for you
PS.exuse me for my english (i am french)

First, make sure the “walk” clip is in the animation array in the inspector. Next, confirm the animation name. I believe it is case sensitive. Following that, make sure the script is attached to the gameObject with the animations. Hope this helps…

Must select “Legacy” at character fbx and at animations fbx

I put the Legacy on the Rig Properties and works fine

Correct answer here

https://answers.unity.com/questions/584106/the-animation-state-could-not-be-played-because-it-1.html