How to I get unity to check if two objects collide?


I am trying to test if two objects intersect each other. But I can’t seem to get it to work. I have colliders on both objects and try to get the collision with the OnCollisionEnter or stay functions. But nothing happens, and I have no idea why. Any help would be much apreciated.

This is the code I use.

function OnCollisionEnter (other : Collision) {
Debug.Log("Hitting me");


At least one of the objects must have a rigidbody. CharacterControllers work too, but you must use OnControllerColliderHit instead of OnCollisionEnter.