private static void ensureInstanceExists() { if (_devInstance == null) { _devInstance = FindObjectOfType <Dev>(); if (_devInstance == null) { _devInstance = new GameObject("__Dev").AddComponent <Dev>(); } } }
private void Start() { foreach (var other in FindObjectsOfType <Dev>()) { if (other != this) { DestroyImmediate(other); } } if (_showGui) { onOpenGui(); } _devInstance = this; DontDestroyOnLoad(gameObject); }