Hi guys, I'm trying to load the new level once the score equals 100. I wrote this script, but nothing is happening once I reach 100, could you advise? Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; public Text scoreText; private int score; void Start() { score = 0; UpdateScore(); } public void PlayNextLevel () { if (score >= 100) { SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1); } } }
Do you call the PlayNextLevel method from anywhere? Because you only have an "UpdateScore" called and only from the Start method.