i made two simple scenes of two rooms, but i dont know how to load scene 2 from within scene 1, this however did not work
void OnTriggerEnter(Collider other)
{
if (other.tag == "Player")
{
Application.loadedLevel (levelToLoad);
}
}
Please help me.,
Firstly, Application.LoadLevel(string/int), but not Application.loadedLevel(string/int)
Secondly, loading the scene by Application class is obsolete. So, if you use new version of Unity, then SceneManager.LoadScene(string/int) is used now instead.
P.S. When you use SceneManager, don’t forget to implement the namespace at the beginning of the script (using UnityEngine.SceneManagement;).
P.S.S. Also, don’t forget to include all scenes in File → Build Settings.