void OnTriggerEnter(Collider collider) { if (collider.gameObject.tag == "Gold") { //collider.gameObject.SendMessage("AddScore"); Gold gold = collider.gameObject.GetComponent <Gold>(); gold.AddScore(); Destroy(collider.gameObject); } }