private void OnTriggerEnter(Collider other) { if (other.GetComponent <BallComp>()) { ++controller.numCoins; if (controller.numCoins == 10) { controller.numCoins = 0; ++controller.numLifes; controller.UpdateValueLifes(); } controller.UpdateValueCoins(); Destroy(gameObject); } }