Why is this error happening?

Here’s a script I wrote to change the scene when a box is touched, but I keep getting an error saying: "The type or namespace ‘MonoBehaviour’ could not be found. Are you missing a using directive or an assembly reference?
I’m using Unity 5.3.5, does anyone know why this is happening?

using UnityEngine.SceneManagement;
using System.Collections;

public class opendoor : MonoBehaviour {
void OnTriggerEnter (Collider other) {
SceneManager.LoadScene(3);
}

}

He forgot semicolon on first line.

2 Answers

2

MonoBehaviour inherits from UnityEngine, afaik.

Been there, done that. That should solve it.

Because you have not imported the UnityEngine namespace.
Add:

using UnityEngine;

to the top of your script.