So Im making my first “minigame” I guess, So when i hit the finish line this gui pops up, on one of the buttons it says next(thats for next level). Currently I have three scenes: Level1, Level2, Level3. I can press next and get to Level2 but it doesn’t work on Level3 (I Have a different script for each level)
Nextscript from 1 to 2
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class NextScript : MonoBehaviour {
public Button NextBtn;
public Text NextBtnTxt;
// Use this for initialization
void Start () {
NextBtn.onClick.AddListener(onClicked);
}
// Update is called once per frame
void onClicked () {
NextBtn.enabled = false;
NextBtnTxt.enabled = false;
SceneManager.LoadScene("Level2", LoadSceneMode.Single);
}
}
NextScript from 2 to 3
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class NextScriptLvl2 : MonoBehaviour {
public Button NextBtn1;
public Text NextBtnTxt1;
// Use this for initialization
void Start () {
NextBtn1.onClick.AddListener(onClicked1);
}
// Update is called once per frame
void onClicked1 () {
NextBtn1.enabled = false;
NextBtnTxt1.enabled = false;
SceneManager.LoadScene("Level3", LoadSceneMode.Single);
}
}
again First one works great, the second one doesn’t