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