private void SetupSingleton() { if (instance == null) instance = this; else if (instance != this) { if (Application.isPlaying) { DaggerfallUnity.LogMessage("Multiple InputManager instances detected in scene!", true); Destroy(gameObject); } } }
public static bool FindSingleton(out InputManager singletonOut) { singletonOut = GameObject.FindObjectOfType(typeof(InputManager)) as InputManager; if (singletonOut == null) { DaggerfallUnity.LogMessage("Could not locate InputManager GameObject instance in scene!", true); return false; } return true; }