Bug behavior with attachmed colliders in Unity

Reproducible 100%

Create gameboject with rigid body + collider prefab
Attach a child gameobject FROM editor, add some collider (make sure they collide, child and parent) but not add a rigid bod to child, only collider.
(all this as prefab)

Add some torque or force to parent gameboject after instantiate.

Result it works and move its child correctly.

Do the same but now, create 2 prefabs parent and child but do not make the child relation in prefab but in runtime.

this is, attach as parent gameboject the child in runtime.

Add force or whatever to parent,
result: it wont move due its child “stuck it”.

But most interesting, check and uncheck the “isTrigger” property FROM EDITOR to the child collider. Now it works marvelous.

As a walk-around I just add in runtime the collider AFTER the parent-child association, not in the child prefab.

But shouldn’t work int the first way?, I think is a bug for the “isTrigger” check/uncheck that makes it work, because is like it “recreate” compounds.

By the way, “isTrigger” check/uncheck from runtime does not work. I guess that from editor it makes some other work besides that check.

Thanks.

The issue here is that the rigidbody doesn’t automatically recognise new colliders that are added at runtime. However, you can destroy the existing rigidbody component and then add a new one to get it to incorporate the new colliders:-

Destroy(rigidbody);
gameObject.AddComponent(Rigidbody);
// Set rigidbody parameters.