As the title, for example, I have total 5 levels in 5 scenes, “scene1” “scene2” “scene3”… When I destroy all the enemy I will move to next scene, is there anyway to use just 1 script which I named it “levelChange” to move from scene1 → scene2 and then from scene2 → scene3? Or I must adjust the script for each scene?
Application.LoadLevel(Application.loadedLevel+1)
Hmmm, i think i have a fix for you.
Lets say that you already have a boolean for if all the enemys are dead called “AllDead”
Var levelToLoad = 0;
var allDead : boolean = false;
function Awake(){
levelToLoad +=1;
}
Function Update (){
if(allDead)
{
application.loadLevel(levelToLoad);
}
}
Set level to load as your starting level and make sure the game object with this script has
“DontDestroyOnLoad (transform.gameObject);”
Hope this helps!