using UnityEngine;
using System.Collections;
public class play : MonoBehaviour {
public AnimationClip anim;
// Update is called once per frame
void Update () {
if(Input.GetKeyDown("e")){
animation.Play(anim.name);
}
}
}
my gameobject Inspector

And console

use [this][1] link might help [1]: http://answers.unity3d.com/questions/577801/animation-must-be-marked-as-legacy.html
– 767_2