This guide explains what to do when unity refuses to play animations and gives the error “The animation state could not be played because it couldn’t be found!“. There’s a few different causes of this error and cause for the animations not to play is listed below.
The animation state AnimationClipName could not be played because it couldn’t be found! Please attach an animation clip with the name ‘AnimationClipName‘ or call this function only for existing animations.
Why the animation state isn’t being found
- You haven’t added the animation clip into the animations list of the animation component.
In order for the animation clip to be referenced via script you first need to make sure the animation clip is actually in the animations list of your animation component.
- Make sure the spelling of the animation clip in your script exactly matches the clip name.
Capitalization, spaces and symbols of the animation clip name should match the clip exactly.
- Animations must be marked as legacy to be used with the animation component.
1. In the project window select the animation clips you’re trying to play.
2. Set the inspector to debug mode which exposes hidden variables, in this case it’ll make the “Legacy” checkbox appear.
3. Tick the “Legacy” checkbox and change the inspector back to normal mode.