void MaintainRatioOfNodeButton() { RootNode.GetComponent <LayoutElement>().minWidth = RootNode.GetComponent <RectTransform>().rect.height; if (isOpen == true) { for (int i = 0; i < ChildNode.transform.childCount; i++) { ChildNode.transform.GetChild(i).gameObject.GetComponent <LayoutElement>().minWidth = ChildNode.GetComponent <RectTransform>().rect.height; } } }