I have a script that changes from Level 1-1 to level 1-2 just fine.
function OnTriggerEnter (other : Collider){
if(other.gameObject.tag == "Player"){
Application.LoadLevel("1-2");
}
}
But I have a script that is exactly the same but to loads level 1-3 instead.
function OnTriggerEnter (other : Collider){
if(other.gameObject.tag == "Player"){
Application.LoadLevel("1-3");
}
}
But when I enter the trigger I get this error:
Level ‘1-3’ (-1) couldn’t be loaded because it has not been added to the build settings.
To add a level to the build settings use the menu File->Build Settings…
UnityEngine.Application:LoadLevel(String)
Level 1-3:OnTriggerEnter(Collider) (at Assets/Scripts/NextLevels/Level 1-3.js:5)
Where is the (-1) Coming from? I have level 1-3 in the Scenes in build menu.
The same thing was happening when I was trying to go from 1-1 to 1-2 but it just stopped randomly.
Thanks in advance for any help.