mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-12-11 21:22:36 +00:00
16 lines
510 B
C#
16 lines
510 B
C#
using UnityEngine.SceneManagement;
|
|
|
|
namespace SanAndreasUnity.Utilities
|
|
{
|
|
public class StartupSingleton<T> : SingletonComponent<T>
|
|
where T : StartupSingleton<T>
|
|
{
|
|
protected override void OnSingletonAwakeValidate()
|
|
{
|
|
Scene activeScene = SceneManager.GetActiveScene();
|
|
|
|
if (!activeScene.IsValid() || activeScene.buildIndex != 0)
|
|
throw new System.Exception("Startup singleton can only be initialized in startup scene");
|
|
}
|
|
}
|
|
}
|