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

No, don’t use it, it’s not necessary!

Use:

Application.LoadLevel(Application.loadedLevel+1);

Application.loadedLevel automatically returns the last level loaded.