animation.Play (MissingComponentException: There is no 'Animation' attached to..

So, I have made an animation clip and attached it to a GameObject in my scene . then i wrote this script and attached it to the same GameObject

using UnityEngine;

using System.Collections;

public class startAnim : MonoBehaviour {

public AnimationClip hand_close_a;

// Use this for initialization

void Start () {



// Update is called once per frame

void Update () {


    if (true)






now whenever I try to run this code I get this error

MissingComponentException: There is no ‘Animation’ attached to the “close_hand” game object, but a script is trying to access it.
You probably need to add a Animation to the game object “close_hand”. Or your script needs to check if the component is attached before using it.
UnityEngine.Animation.Stop (System.String name) (at C:/BuildAgent/work/d3d49558e4d408f4/artifacts/EditorGenerated/Animations.cs:512)
startAnim.Update () (at Assets/tutorial/scripts/startAnim.cs:24)

Well, you need to put an Animation into your gameObject, for that select your gameObject and click Add Component → Miscellaneous → Animation, now you have an animation attached to your gameObject, in the new animation window created you can put your animations, put “hand_close_a” into Animations and your script will work.

the animation state “Walk” could not be found .
“Walk” must be marked as Legacy