protected void OnDestroy() { if (singleton == this) { singleton = null; } }
protected void Awake() { // Awake is for initialisation and connecting scripts!!! // Check if there is already a singleton instance if (singleton == null) { singleton = this; DontDestroyOnLoad(singleton); init(); } else { //if there already was one, destroy this new instance again Destroy(this); } }
void Awake() { instance = this; }