Esempio n. 1
0
 public static void Disable()
 {
     if (_instance != null)
     {
         GameObject.Destroy(_instance.gameObject);
         _instance = null;
     }
 }
Esempio n. 2
0
 void OnDestroy()
 {
     if (this == _instance)
     {
         _instance = null;
         toasts.Clear();
     }
 }
Esempio n. 3
0
 // call Initialize() when the app loads.  This will create the singleton game object.
 public static void Initialize()
 {
     if (_instance == null)
     {
         GameObject go = new GameObject("ToastCenter");
         _instance = go.AddComponent <ToastCenter>(); // will finish initializing in OnEnable()
     }
 }
Esempio n. 4
0
 void OnEnable()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(gameObject);
         return;
     }
     if (_instance == null)
     {
         _instance = this;
         _instance.InitInternal();
         DontDestroyOnLoad(_instance.gameObject);
     }
 }