Script Error : On Collision Enter - I need a solution.

Hello, I have a script which is below. when I use it, it does not work. I used a debug.log on the first two lines and it worked. My projectile is named “Bullet” and the target is “Mob” Any help would be great.

SCRIPT:

function OnCollisionEnter(other: Collider){
if(other.tag == "Mob"){
Destroy(other.gameObject);
}

}

1 Answer

1

OnCollisionEnter takes a Collision as a parameter and not a Collider, OnTriggerEnter does take a Collider.

complementing: [doc link][1] [1]: http://docs.unity3d.com/Documentation/ScriptReference/Collider.OnCollisionEnter.html