im trying to make an interactive script to open doors in unity and when i try to use IEnumerator, it says “the type or namespace name ‘IEnumerator’ could not be found”. i cant seem to find a solution yet and so i thought i would ask about it online. The script is shown below
using UnityEngine;
public class Door : MonoBehaviour
{
public GameObject door_closed, door_open;
public bool open;
void OnTriggerStay(Collider other)
{
if(other.CompareTag("Door Detect"))
{
if(Input.GetKeyDown(KeyCode.E))
{
door_closed.SetActive(false);
door_open.SetActive(true);
StartCoroutine(repeat());
open = true;
}
}
}
IEnumerator stay(){
yield return new WaitForSeconds(4.00f);
open = false;
door_closed.SetActive(true);
door_open.SetActive(false);
}
}