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