/// <summary> 싱글톤 인스턴스 생성 </summary> private static void CreateSingletonInstance() { GameObject go = new GameObject("Custom Observables (Singleton Instance)"); _instance = go.AddComponent <CustomObservables>(); DontDestroyOnLoad(go); }
/// <summary> 싱글톤 인스턴스를 유일하게 유지 </summary> private void CheckSingletonInstance() { if (_instance == null) { _instance = this; DontDestroyOnLoad(gameObject); } else if (_instance != this) { Destroy(this); } }