private void OnCollisionEnter(Collision collision) { if (collision.other.gameObject.CompareTag("Player")) { PlayerMovement p = collision.other.gameObject.GetComponent <PlayerMovement>(); if (p) { p.AddTorpedos(1); Destroy(gameObject); } } }