- Home /
Loading next level in js
Hello Unity Answers. I am trying to load next level on collision with end of map. So i created an script that sends the user to an level when hit the collider. But i am having problems with adding "1" to currentLevel. So that it will change to next level. I tried this:
Application.LoadLevel (PlayerHealth.currentLevel + 1);
But it doesn't work.
PlayerHealth.currentLevel is an static var added to the character of the game that sets the currentLevel.
Frederik
Answer by BiG · Apr 28, 2012 at 06:41 PM
No, don't use it, it's not necessary!
Use:
Application.LoadLevel(Application.loadedLevel+1);
Application.loadedLevel automatically returns the last level loaded.
Your answer
Follow this Question
Related Questions
Rigidbody (Player) goes through wall 1 Answer
How can i add different jumping state in unity3d 1 Answer
Select randomly x arrays and instantiate them 1 Answer
About "SplineController" Javascript 1 Answer
What is wrong with this script? 0 Answers