I followed a tutorial that was a little old, and the line
Application.LoadLevel (“Scene” + commandModifier);
is obsolete, so I need to use SceneManager now, but I’m not sure how… I’m completely new to coding and programming and I’m using/learning c#…any suggestions?
here’s the code:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ChoiceButton : MonoBehaviour {
public string option;
public DialogueManager box;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void SetText(string newText) {
this.GetComponentInChildren<Text> ().text = newText;
}
public void SetOption(string newOption) {
this.option = newOption;
}
public void ParseOption() {
string command = option.Split (',') [0];
string commandModifier = option.Split (',') [1];
box.playerTalking = false;
if (command == "line") {
box.lineNum = int.Parse(commandModifier);
box.ShowDialogue ();
} else if (command == "scene") {
Application.LoadLevel("Scene" + commandModifier);
}
}
}
I already put
using UnityEditor.SceneManagement;
at the top but I don’t know how to do the load level part…Sorry if this is a dumb question…haha