void OnCollisionEnter(Collision collision) { if (collision.collider.CompareTag("Enemy")) { // Perform actions if player collides with enemy } }In this example, we use the OnCollisionEnter method to detect when the player collider collides with another collider. Then, we use the CompareTag method to check if the collider's tag is "Enemy". If it is, we can perform certain actions such as reducing player health or destroying the enemy object. This method is part of the UnityEngine library, which is a core part of Unity game development.