MIF_E31222569/Assets/ToothyV/Scripts/SceneController.cs

50 lines
910 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneController : MonoBehaviour
{
public static SceneController Instance;
private void Awake()
{
if (Instance == null)
{
Instance = this;
}
else
{
Destroy(gameObject);
}
}
private void Start()
{
DontDestroyOnLoad(gameObject);
}
public void LoadScene(string scene)
{
SceneManager.LoadScene(scene);
}
public void LoadScene(int scene)
{
SceneManager.LoadScene(scene);
}
public void NextScene()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
}
public void RestartScene()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}