- Home /
Question by
galaadr · May 26, 2017 at 04:51 AM ·
scenescene-loadingscene load
issue with SceneManager.LoadScene
hello there , i have a main scene at the index 0 , i created more scenes that are just enemies that spawn when all the previous enemies are dead . i try to add them with SceneManager.LoadScene(scene, LoadSceneMode.Additive)
and i don't know why it doesn't work . here is more code for you to understand
using UnityEngine.SceneManagement;
public int currentScene;
void Start () {
currentScene = 1;
}
public void nextLevel ()
{
SceneManager.LoadScene(currentScene , LoadSceneMode.Additive);
Time.timeScale = 0;
currentScene ++;
lvlNumber++;
displayLvl();
StartCoroutine(startPlay());
sound.startLevelSound(.8f);
}
Comment
problem solved i was an idiot
the way it changes level is when there is no enemy on screen , but there where none in the third scene , so it increment infinitly .