//Jimmy Vegas Unity Tutorial //This script will open your door using System.Collections; using System.Collections.Generic; using UnityEngine; public class DoorOpenFirst : MonoBehaviour { public GameObject theDoor; public AudioSource doorFX; void OnTriggerEnter(Collider other) { doorFX.Play(); theDoor.GetComponent().Play("DoorOpen"); this.GetComponent().enabled = false; StartCoroutine(CloseDoor()); } IEnumerator CloseDoor() { yield return new WaitForSeconds(5); doorFX.Play(); theDoor.GetComponent().Play("DoorClose"); this.GetComponent().enabled = true; } }