Noob collision detection problem.

Well as you can see by the title im a newb with Unity and im having some problems with collision detection. What I am trying to do is detect a collision between two character controllers and act on it, I have this code attatched to one object.

void OnCollisionEnter(Collision obj)
    {
        Debug.Log("Collided!");
        if (obj.gameObject.tag == "tail")
        {
            gameOver = true;
            Debug.Log("You lose!");
        }
    }

My problem here is that no collisions are being detected, I have tried attaching ridgid bodies to the objects but nothing seems to work and i am unsure whether its my code ot something else and im hoping someone here can help me out.

Thank you in advance.

Did you add a collider (box or mesh, etc.) to the objects?

Yes but still nothing happens.

If you are using character controllers, use OnControllerColliderHit().

Aha! Everything works now, thank you. :smile: