Animation State could not be played

The Animation State could not be Played, because it could not be found.
Is the error I receive. The tutorial that I’m working on is Survival Island
from the Packtpub.Unity.3.x.Game.Development.Essentials (Book)
I’ve gotten half way through it and I don’t want want to be a quitter.
When I throw a coconut on the target is says “The Animation State could not be Played, because it could not be found.”
Does anyone know what I should do to resolve this problem?

To elaborate on above answer, it’s trying to play an animation by name, like:

animation.Play(“hitAnim”);

or just

animation.Play(); (if the object only has one anim, I guess)

So, it can’t find the anim in question, which means there is no animation with that name attached to the object in question. (If the line failing is “animation.Play();”, that means there is no anim attached). If you select the object, then look at the “Animation” component in the inspector, you can assign the animation there. Often, the first step before you can do this is to split the anims on the model itself, which is done on the .fbx model itself, which you can select in the project pane. Then, with it selected, the FBX importer should become visible in the inspector panel. That’s where you can name/split your anims… If you give more info, it might help…

Presumably, this is happening because the AnimationState that you are retrieving (usually by accessing ‘animation[string]’) is invalid. Make sure that you’re spelling the name of the animation properly, and that the animationClip in question is actually attached to the animation component in the inspector.