OldBlueWater/BlueWater/Assets/Blobcreate/Projectile Toolkit/Demos/Scripts/Misc/SceneLoader.cs

38 lines
715 B
C#
Raw Normal View History

2023-08-10 08:23:04 +00:00
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Blobcreate.ProjectileToolkit.Demo
{
public class SceneLoader : MonoBehaviour
{
public void LoadScene(int index)
{
var current = SceneManager.GetActiveScene();
if (current.name.Contains("Title Screen"))
Helper.titleScreen = current.buildIndex;
SceneManager.LoadScene(index);
}
public void Back()
{
if (Helper.titleScreen != -1)
{
SceneManager.LoadScene(Helper.titleScreen);
Cursor.visible = true;
}
else
{
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#endif
}
}
public void Reload()
{
var i = SceneManager.GetActiveScene().buildIndex;
LoadScene(i);
}
}
}