protected void OnEnable() { if (Instance != null) { Instance.enabled = false; } Instance = this; }
protected void Start() { Instance = this; backpack = GameObject.FindGameObjectWithTag("backpack").GetComponent <BackpackManager>(); #region Another Approach /*Debug.Log("at least start"); * FocusController[] focuses=GameObject.FindObjectsOfType<FocusController>(); * foreach (FocusController f in focuses) * { * if (f == this) * { * Debug.Log("me"); * continue; * } * else * { * Debug.Log("others"); * f.gameObject.SetActive(false); * } * } * Debug.Log("i'm the only focus");*/ #endregion }