how to switch between scene

hi everyone, im trying to switch from one level to the other here is my code

var myLevel : String;

function OnCollisionEnter (myCollision : Collision) {
if(myCollision.gameObject.name == “Floor”){
Application.LoadLevel(myLevel);
}
}

but it just work when i add a rigibody to my player but when i did it my player start jumping like crazy

It has now been updated to this:

using UnityEngine.SceneManagement;

// In a function
 SceneManager.LoadScene(1); //replace the int with level number

In unity go to File >> Build settings.
A new window will pop up. Just hit add current to add you’re current scene. You also can drag your scenes from your project folder. Then they’re appear numbers next to the name of your scene. In your script use this instead:

function OnCollisionEnter (myCollision : Collision) 
{ 

if(myCollision.gameObject.name == "Floor")
{ 
Application.LoadLevel(// The number next to the scene in the build settings window);
} 
}

yes you should make it a trigger so the player doesn’t bounce off

It’s currently

SceneManagement.SceneManager.LoadScene("sceneName");