Why won't the collision work?

#pragma strict

function OnCollisionEnter(hitIt : Collision) {


I am trying to make a another primitive sphere be destroyed when it collides with this one. Both spheres have a collider and this one is a trigger. The other has rigid body. I tried changing something in the script and I got a compiling error so I know it’s using the script.

OnCollision functions use (col : Collision){ - and it does not need to be isTrigger

OnTrigger functions use (col : Collider){ - This one needs to be isTrigger

That means that none of those two SphereObjects need to be checked as isTrigger

If this is the script attached to the trigger, you want to do this instead:

function OnTriggerEnter(hitIt : Collider){

Reason: Collider components set to be “trigger” send the OnTriggerEnter message, not the OnCollisionEnter message.

Also make sure one of the colliding objects have a rigidbody attached.