onCollisionEnter

function OnCollisionEnter(theCollision : Collision){

   if(theCollision.gameObject.tag=="playerMissle") {

     Destroy(gameObject);
   }

}

This script keeps giving me a:

Script error: OnCollisionEnter
This message parameter has to be of type: Collision
The message will be ignored.

The gameobject it is placed on is a cuble with a box collider, rigidbody (that is kinematic), and the player missle is a prefab cube that is fired that has a box collider, rigidbody without kinematic, and is in the tag “playerMissle”.

Everyone keeps saying use this to check collision and destroy and object but I get this error everytime.

Just want to share if others bump into this forum.
in some case,
//check the parameter - instead of (Collider col) → (Collision col)

void OnCollisionEnter (Collision col){

}

Make sure that you don’t have some class or script called Collision - it makes Unity try to use that instead of it’s own version.

function OnCollisionEnter(collision : Collision){

if(collision.gameObject.tag==“playerMissle”) {

 Destroy(gameObject);

}

}