Deactivate Specific Children In Partent

Hello,

I have a game object with meny children. And right now I use this script to turn off all the children.

But is it possible to turn off specific children (im using renderer to deactivate):

var renderers = GetComponentsInChildren(Renderer);
for (var r : Renderer in renderers) {
    r.enabled = false;
}

So if my children were names:

Child1 Child2 Child3

How would I turn off all children except Child2?

You could just check the name of the current object in the loop:

var renderers = GetComponentsInChildren(Renderer);
for (var r : Renderer in renderers) {
    if (r.name != "Child2") r.enabled = false;
}