Disable multiple child components

I’ve checked online but couldn’t find much help. I’m making a FPS and he’s going to have multiple guns. To switch weapons, I want to animate him putting it away, then disable the renderers for all the children components rather than copy and pasting about 20 times, turning off each part of the gun and arm manually. Is there a way I can simply turn off the renderers for all the child components of a game object? I know it will have something to do with GetComponentInChildren, but I’m still not sure. Thanks for any help.

This is as simple as using GetComponentsInChildren() and then going through the array as needed.

var renderers : Renderer = GetComponentsInChildren.< Renderer >();//you need to remove the spaces inside the < >

and then disable the renderers as needed using a for loop or a for-each loop.

The FPS tutorial uses a similar method of switching weapons.

Hope this helped