"Default clip could not be found in attached animations list" even though it is in the animations list

Scene setup:

Code attached to collider script:

	public GameObject weaponObject;

void OnMouseDown(){
		Debug.Log(weaponObject);
		weaponObject.animation.Play();
}

I honestly don’t know where I am going wrong, every time I click it says “Default clip could not be found in attached animations list”. If I change the code to animation.Play(“swing”); it errors and says the animation could not be found. Please NOTE that the animation itself is applied to the child mesh (pCube1) inside the swordMain prefab.

Driving my crazy, I have tried everything I can think of. Another weird glitch is that the animation always plays once when I start the game, despite play automatically and loop being turned off.

Thanks in advance

Did you check to see if your animation was marked as legacy?

The animation component is a legacy tool, so you need to goto the top right of the Inspector and enter Debug Mode and set the animation to legacy.

Everything should work afterwards.

I hope that helps.

qoobit, you just ended my 1&1/2 hr misery of trying wondering why it just will not find my animation. Thank you Sir!.