private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { takeBox.Play(); if (myRefToSpawner != null) { myRefToSpawner.DecreaseInstanceBox(); } if (FindObjectOfType <Player>() != null) { FindObjectOfType <Player>().SetPoints(200); } Destroy(gameObject); } }