Deactivate gameobject and all children

I there any way in C# that you can deactivate a game object and all its children. I have a game object that has like 25 children I want to deactivate that gameobject and all of its children.

the parent transform contains an implicit list of children.

foreach (transform child in parent.transform)
child.gameobject.enable = false;

Thats the most elegant way i think.

Mark as answered :slight_smile: