When i am finishing the second level i am getting an error. It loads the first scene anyway but it bugs me a little. here is the error:
and here is my code:
private void LoadNextLevel()
{
int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
//Debug.Log((SceneManager.sceneCountInBuildSettings - 1) == currentSceneIndex);
if((SceneManager.sceneCountInBuildSettings - 1) >= currentSceneIndex )
{
SceneManager.LoadScene(0);
}
SceneManager.LoadScene(currentSceneIndex + 1);
}
both scenes are in the builder. the value in the Debug.Log Method returns true. as i mentioned it loads the map anyway. but i wanna get rid of the error.
i hope anyone can help
Dubi