Get children of another object in hierarchy.

Hello,
I want to get children objects of another object in hierarchy which does not contain script in which I’m coding, and then disable the children objects through code:

SetActive(false);

Let’s say my script is attached to an object called “GameManager” and I want to get children objects of an object called “MenuPanel” and disable them.

How do I do it? I don’t see any function which allows me to do it. I can only see GetComponentsInChildren etc. but I want don’t want to get components, I want to get CHILDREN OBJECTS. I tried getting component GameObject but it seems it is not a component.

As @Masterio said , You should first find the gameObject you want to set its children to be disabled . So use GameObject.Find(“MenuPanel”) to find the MenuPanel object , Then use its transform to access its childs and then disable theme like this :

var menuPanelTransform = gameObject.Find("MenuPanel").transform;
menuPanelTransform.FindChild("child_0").gameObject.SetActive(false);

If you can , reference “MenuPanel” gameobject in your script , So you don’t have to find it every time.