private void OnDestroy() { if (Instance == this) { Instance = null; } }
private void Awake() { // Singleton set. if (!Instance) { Instance = this; } else { Destroy(gameObject); } }