void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("projectile")) { Debug.Log("[Enemies] Collide with projectile"); Destroy(gameObject); } if (collision.gameObject.CompareTag("Player")) { ControlPlayer ctplayer = collision.gameObject.GetComponent <ControlPlayer>(); ctplayer.declife(); Destroy(gameObject); Debug.Log("[Enemies] Collide with player"); } }