Scene Manager

Apparently, I’m making a main menu and I want to load the scene when the players press the Start button. However, when I referred to SceneManager, the console said it doesn’t exist in the current context (I use Unity 4.7.2 by the way)
Here’s my script
using System.Collections;

public class LoadSceneOnClick : MonoBehaviour {

public void LoadByIndex (int sceneIndex)
{
SceneManager.LoadScene (sceneIndex);
}
}

You will need this namespace if you don’t have it yet.

using UnityEngine.SceneManagement

Although not sure if this scene management stuff is pre 4.7

1 Like

Yeah I don’t think SceneManager was in Unity 4. You need to do Application.LoadLevel(sceneIndex).

1 Like