Can anyone help me someone with this code?
I'd like to go to the next level by clicking a button: example my level name is L1,L2,L3,L4,L5,L6,L7 and when I finish level L1, I want to go to level L2 with the click of a button, and from L5 go to L6 like this.
public class GameLevels : MonoBehaviour {
public Button Play;
private int idLevel;
// Use this for initialization
void Start ()
{
idLevel = PlayerPrefs.GetInt("idLevel");
Play.interactable = false;
}
public void SelectLevel(int i){
idLevel = i;
PlayerPrefs.SetInt ("idLevel", idLevel);
Play.interactable = true;
}
public void LoadLevel(string Levels)
{
SceneManager.LoadScene (Levels);
}
public void Replay()
{
SceneManager.LoadScene ("L" + idLevel.ToString ());
}
public void loadNextLevel()
{
}
}
SceneManager.LoadScene ("L" + (idLevel + 1).ToString ());
does not work? \$\endgroup\$ – realUser404 Dec 2 '16 at 15:22