I’m using Unity 5. I have a game object which is part of an array (faces for example) and because I’m not sure which childobject in my object is active at a specific time i want to deactive all the children at once. How could i do this? I need a C# script.
Try this in a script that controls your array.
private GameObject[] Subs;
...
void ...
Subs=faces_.GetComponentsInChildren<GameObject>(); //Returns face *and all its children*_
for(int k=0;k<Subs.Length;k++) Subs[k].SetActive(false); //Deactivate face and all its children
faces_.SetActive(true); //Reactivate face without children, they remain inactive_
…