Detecting collision on nested object

I'm having trouble getting a collider to work.

I have a few game objects inside of a container gameboject. The game objects on the inside have a box collider on them.

I add the game object to another at creation time by parenting them.

I also have another game object which is my hero character which also has a game object on it and is trigger set to true. I have also attached a rigid body to the hero game object.

So I have met all the conditions of collision right?

When I try this on the hero script.

void OnTriggerEnter(Collider other) {



I don't get "blah" when it collides and I can see it colliding in the scene view.

But if i place a collider on a game object which is not nested it seems to work. Am I missing something.

If the parent contains a RigidBody it will take over all collisions for children.

By design, compound colliders act as a single collider when you add a rigidbody to the parent, and therefore only the root object will react to < collisions >

Taken from Eric5h5's comment on this question:

Edit: Does the bounds of parent collider contain the child collider? Can you try making the parent collider very small to see if that changes the behaviour? In my experience with compound colliders the first hit is the only one which is activated.

I worked out what was wrong. I needed to apply a rigid body to each object in the parent. I wrote a better answer in the forums.