// setup singleton if allowed public void Awake() { if (!_created && allowSingleton) { DontDestroyOnLoad(this); instance = this; _created = true; Setup(); } else { if (allowSingleton) { if (JPushEventManager.instance.allowWarningOutputs) { Debug.LogWarning("Only a single instance of " + this.name + " should exists!"); } Destroy(gameObject); } else { instance = this; Setup(); } } }
public void Awake() { if (!JPushEventManager._created && this.allowSingleton) { UnityEngine.Object.DontDestroyOnLoad(this); JPushEventManager.instance = this; JPushEventManager._created = true; this.Setup(); } else if (this.allowSingleton) { if (JPushEventManager.instance.allowWarningOutputs) { Debug.LogWarning("Only a single instance of " + base.name + " should exists!"); } UnityEngine.Object.Destroy(base.gameObject); } else { JPushEventManager.instance = this; this.Setup(); } }
static JPushEventManager() { instance = new JPushEventManager() ; }
static JPushEventManager() { instance = new JPushEventManager(); }