An object reference is required for the non-static field method or property 'unityengine...

i have a problem with a piece of code for opening and closing a sliding door using an animation made in unity.
code is below:

using UnityEngine;
using System.Collections;

public class Door_Behavour : MonoBehaviour {

    void onTriggerEnter(Collider Player)
    {
        Animation.Play("RD_Open");

    }

    void OnTriggerExit(Collider Player)
    {
        Animation.Play("RD_Open");
    }
    IEnumerator ExitTimer()
    {
        yield return new WaitForSeconds(2);
        Animation.Play("RD_Close");
    }
}

i have an error after each time i want to play an animation, the error is as follows:

An object reference is required for the non-static field, method or property ‘UnityEngine.Animation.Play(string)’

any help would be appreciated

also if this post is in the wrong place, i was not sure where to post it

Try posting here: Unity Engine - Unity Discussions

You haven’t defined the animation you are trying to play.
Should be something like:
myAnimation.Play(“RD_Close”);
or whatever the case is.

“Animation” is a class. You’re treating it like an object, which doesn’t work.

Is this code based on a tutorial, by any chance? In Unity 4.x and earlier “animation” (with a lower-case “a”) was a convenient way to access an animation object attached to a GameObject.

Closed as duplicate