Change level script

I have a script I used all the time in Unity 4 and now I think Unity 5 has changed some stuff to where the script wont work. I am also gonna ask is there a way to where I can set it to where all I have to do is put the script on a trigger then the scene so I don’t need to make so many scripts?

Script: C#

using UnityEngine;
using System.Collections;

public class L12L2 : MonoBehaviour {
	
	void changesceneto() {
		Application.LoadLevel (2);
	
	}
}

youre load lvl seems to be correct did you remember to add the scene to youre build? and to avoid making so many scripts you could make

Public String LevelToLoad = "Level1";

and then use the string inside youre

Application.LoadLevel (LevelToLoad);

just change the Strings text per scene

You’re command is correct, you just need to make sure all your scenes are setup correctly in the build settings: Application.LoadLevel(2);

You don’t need to make a new script for each Application.LoadLevel();

in a single script you could have multiple methods loading different levels;

public void goToSceneOne(){
Application.LoadLevel(1);
}

public void goToSceneTwo(){
Application.LoadLevel(2);
}

or else you could pass an int value:

public void switchScene(int i){
Application.LoadLevel(i);
}