// ================================= // Functions. // ================================= // ... void Awake() { if (instance && !Application.isEditor) { Destroy(gameObject); } else { instance = this; } }