OnCollisionEnter() not working in Unity3D

I have an object with a mesh collider and a prefab with sphere collider. I want the instance of the prefab to be destroyed if the two collide.

I wrote the following in a script:

private void OnCollisionEnter(Collision c)
{
    if (c == target)
        Destroy(transform.gameObject);
    print("something");                   // Doesn't get printed
}

But it is not working. I have tried toggling isTrigger on both the objects.

Leave a Comment