/// <summary> /// Creates a instance of this object, if there is an instance already delete the new one /// </summary> private void Init() { if (s_Instance == null) { s_Instance = this; } else { Destroy(gameObject); } }
void Awake() { if (instance == null) { instance = this; } else if (instance == this) { Destroy(gameObject); } }