void Awake() { // Make this an indestructible singleton if (Instance == null) { Instance = this; } else if (!Instance.Equals(this)) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
void Start() { Faider = ScreenFaider.Instance; Faider.FadeOut(FadeSpeed, delegate { loading = false; if (AutoLoad) { DelayedAction(AutoLoadTime, delegate { LoadScene(ExitScene); }); } }); }
/// <summary> /// Destroy this singleton instance /// </summary> public static void DestroySingleton() { Destroy(Instance.gameObject); Instance = null; }