Hey all,
So, we all know we can enable all selected children of gameobjects using this code, and obviously also disable them with a small change.
[UnityEditor.MenuItem("GameObject/Enable All Children")]
private static void EnableAllChildren()
{
foreach (var go in UnityEditor.Selection.gameObjects)
{
for (int i = 0; i < go.transform.childCount; i++)
{
go.transform.GetChild(i).gameObject.SetActive(true);
}
}
}
However, what i want is the equivelent of pressing H (which toggles the scene visibility) but only on the children, so my question is, how can I change it so what Im looking for is
how can i programattically expand/unexpand a gameobject in the heirachy
how can I programattically show/hide a gameobject in the heirachy
eg I want to add that functionality to a script with the above.
I feel like i missed something obvious