Blender model animations not found after import

Hi everyone, I have a model that is the second I’ve create for my game. The first, I was able to import into unity with it’s animations already attached with an animation component, but my second model imports without them. in addition, if I add the animation component in and drag the animations on to it, unity still can’t find it in game. I get the following error;

The animation state Open could not be played because it couldn't be found!
Please attach an animation clip with the name 'Open' or call this function only for existing animations.
UnityEngine.Animation:Play(String)
Chest:Open() (at Assets/Scripts/Chest.cs:39)
Chest:OnMouseUp() (at Assets/Scripts/Chest.cs:31)
UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32)

I’m not sure if this problem is due to unity or blender. this is how my animation work space appears prior to a save (I open my models in blender as .blends)

Update: I’ve since tried to export it as an .obj file, but the problem remains, so it can’t be due to the .blend format

Here is the object in game

And here is the code that uses the animation;

using UnityEngine;
using System.Collections;

public class Chest : MonoBehaviour {
	public enum State {
		open,
		close,
		inbetween
	}
	public State _state;
	
	// Use this for initialization
	void Start () {
		_state = Chest.State.close;
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	public void OnMouseEnter() {
		Debug.Log("enter");
	}
	public void OnMouseExit() {
		Debug.Log("exit");
	}
	public void OnMouseUp() {
		Debug.Log("Up");
		if (_state == Chest.State.close){
			Open ();
		}
		else{
			Close();
		}
	}
	
	private void Open(){
		animation.Play("Open");
		_state = Chest.State.open;
	}
	private void Close(){
		animation.Play("Close");
		_state = Chest.State.close;
	}
}

Currently that animation component has no animation clip assigned, but 3 clips available.

Are you selecting the clip to play?

Animation Component in the docs

Animation.Play() in the docs

If you simply use Animation.Play() there is no default animation to play.
If this is the case, you’d want to say: Animation.Play (“Open”); for example

If this isn’t the answer you are looking for, can you post your code?

FWIW: When I animated a chest lid, I set the default animation to Open, and then played Open to open the chest and played Open backwards to close it, so there was only one animation:

public void LootWindowToggle (bool toggle) {									//	A setter to set the lootPanelOpen to closed and stop TestDistance
	lootPanelOpen = toggle;
	PlayAnimation (toggle);														//	Is this the correct location?
}

protected void PlayAnimation (bool toggle) {
	if (thisAnimation) {
		if (toggle) {
	        foreach (AnimationState state in thisAnimation) {
				if (state.normalizedTime < 0.0f)
		            state.normalizedTime = 0.0f;
	            state.speed = 1.0f;
	        }
		} else {
	        foreach (AnimationState state in thisAnimation) {
	            if (state.normalizedTime > 1.0f)
		            state.normalizedTime = 1.0f;
	            state.speed = -1.0f;
	        }
		}
		
		thisAnimation.Play();
	}
}

Ok, it turns out that if you have a project that transfers from version 3.x you might have to change the animations to “legacy” animations under import settings for the model’s armature. After that, it should work perfectly.