27 lines
536 B
C#
27 lines
536 B
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class GameManager : MonoBehaviour
|
|
{
|
|
public static GameManager instance;
|
|
public static string TargetScene;
|
|
|
|
private void Awake()
|
|
{
|
|
if (instance == null)
|
|
{
|
|
instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
public void LoadScene(string sceneName)
|
|
{
|
|
TargetScene = sceneName;
|
|
SceneManager.LoadScene(sceneName);
|
|
}
|
|
} |