Why dont collision detection works on child object?

Hi, I have a Enemy which is from many parts. It looks like cube, and each wall is a separeta object, that is a child of a empty gameObject witch rigidbody, because i want it to response to physics. BUT. I have a script like this

var TextureState1 : Texture2D;
var TextureState2 : Texture2D;
var TextureState3 : Texture2D;

var hits : int = 0;

function OnCollisionEnter(other : Collision)
    if(other.gameObject.tag == "explodeWall")
                                 = TextureState1;

so, what it should do? I have a ball prefab i can shoot, and i have this script attached to the ball. When i shoot a ball to a object with tag explodeWall it does what it should. It changes the material. But when its a child object, even the SAME but its just a child, this dont works :(.

Ok, now i know where is the problem. It dont works when it has a parent rigidbody. So? :(


It seems that’s how Unity works. When something collides with a compound rigidbody, OnCollision*() are called only on the parent, even if a child’s rigidbody collided first. You can work your way around this by putting a script on your empty GameObject that handles OnCollisionEnter() and forwards the event to your children.