using UnityEngine; using UnityEngine.SceneManagement; /// /// Class to handle scene loading callbacks /// public class ChangeSceneOnClick : MonoBehaviour { /// /// Method used as callback for gameobject onClick events /// /// The path to the new scene (path == $"Assets/{sceneName}") public void LoadScene(string sceneName) { SceneManager.LoadScene(sceneName); } /// /// Method used as callback for gameobject onClick events /// /// Reference to a scene public void LoadScene(Scene scene) { SceneManager.LoadScene(scene.buildIndex); } /// /// Method used as callback from gameobject onClick events /// /// Build index of the scene to be loaded public void LoadScene(int buildIndex) { SceneManager.LoadScene(buildIndex); } }