How to correct add collider to every child of gameobject?

Hi all,

I’ve always used unity especially for 2D games. A friend, who’s really interested in 3D development in unity, asked me to review a project for him. One of the questions he had was how to add colliders to “advanced” gameobjects in unity. What I’m talking about is an object that has hundreds of children. I need a way to add the appropriate mesh collider to the appropriate child. Is there a script or editor extension for this?

foreach (Transform t in transform)
{
if (t == transform) continue; // Skip the transform itself
t.gameObject.AddComponent();
}

But I wouldn’t recommend it. Instead, model one big collider in any 3D Software for the whole thing, this might get very expensive on the CPU.