Disable Component of all child GameObjects

I want to disable the colliders for all the child gameobjects. I have the ConponentsInChildren. But I’m not sure how to go through each one to disable the component.

GetComponentsInChildren returns you an array. Just iterate through it with a for / foreach loop.

// C#

foreach( Component comp in componentList )
    comp.enabled = false ;

(Replace Component by the component type you get with ConponentsInChildren)

Here’s a tutorial for that : https://unity3d.com/learn/tutorials/modules/beginner/scripting/enabling-disabling-components

Use a loop for each child : Unity - Scripting API: Component.GetComponentsInChildren

Tell me if you need more help :slight_smile: