How to set active false all gameObject children ?

Hi guys ! There is a way to set active false all gameObject children via script ? Thank you guys :slight_smile:

Hello,

it can be achived by Recursion

	private void SetActiveAllChildren(Transform transform, bool value)
	{
		foreach (Transform child in transform)
		{
			child.gameObject.SetActive(value);

			SetActiveAllChildren(child, value);
		}
	}

try this

 public Transform parentTransform;

    void Start()
    {
        for (int j = 0; j < parentTransform.childCount; j++)
        {
            parentTransform.GetChild(j).gameObject.SetActive(false);
        }
    }