void Awake() { if (instance != null) { Debug.Log ("Wrong"); //Destroy (gameObject); return; } instance = this; }
public static DontGetDestroyedOverlay GetInstance() { if (instance == null) { GameObject go = new GameObject("Whatever"); go.AddComponent<DontGetDestroyedOverlay>(); instance = go.GetComponent<DontGetDestroyedOverlay>(); } return instance; }