Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. private void LoadNextLevel()
  2. {
  3. int currentSceneIndex = SceneManager.GetActiveScene().buildIndex;
  4. SceneManager.LoadScene(currentSceneIndex);
  5. int nextSceneIndex = currentSceneIndex + 1;
  6.  
  7. if (nextSceneIndex == SceneManager.sceneCountInBuildSettings)
  8. {
  9. nextSceneIndex = 0; // loop back to start
  10. }
  11. SceneManager.LoadScene(nextSceneIndex);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement