private void OnTriggerEnter(Collider other) { if (other.tag == "Player") { switch (this.name) { case "Gold": case "Gold(Clone)": Manager.AddMoney2(); Destroy(this.gameObject); break; case "Coin": case "Coin(Clone)": Manager.AddMoney1(); Destroy(this.gameObject); break; case "FirstAidKit": GameObject.FindObjectOfType <UI>().HealthBar.value += 5f; Destroy(this.gameObject); break; } } }