object collision does not work

Hello, i am trying to make a simple tower defence game, and i have some problems with enemy and tower collision…

I have this Enemy script:

void OnCollisionEnter(Collision collision) {
		Debug.Log (collision.gameObject.name); // never happens

And theres a box collider on the enemy aswell.

And then i have a tower object, with a child “col” that have a sphere collider.

Some Pics:

What am i doing wrong?
Thank you in advance

P.S. also tried to add the sphere collider to the tower object, didn’t work.

I would use

function OnTriggerEnter (other : Collider)


On the enemy Collider make sure you Check on
Is Trigger

Hope this help.

I also post videos online
link text

from the manual:

“Note that collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached.”

does either have a non-kinematic rigidbody?

Also if you’re saying the debug.log never occurs then why don’t you do a simpler bit of logging so you know 100% whether the collision is occuring or the problem is in one of the other lines in your collision code:


If that never gets logged then at least you know 100% that function isn’t being called and it’s a problem in your collider setup.

EDIT: having looked at your screenshots I can’t see any rigidbodies attached so that’s your problem I reckon.