diff --git a/Assets/Scripts/UI/UIBody3D.cs b/Assets/Scripts/UI/UIBody3D.cs index 09963fdf..18e5de50 100644 --- a/Assets/Scripts/UI/UIBody3D.cs +++ b/Assets/Scripts/UI/UIBody3D.cs @@ -421,7 +421,6 @@ namespace QFramework.Example bodyItem.transform.Find("Content/Btns").gameObject.SetActive(false); bodyItem.transform.Find("Content/Label").GetComponent().text = body.Name; var bodyToggle = bodyItem.GetComponent(); - bodyToggle.isOn = body.isShow; GameObject obj = Utility.FindObj(body.Path); obj.SetActive(body.isShow); bodyToggle.onValueChanged.AddListener(isOn => @@ -429,6 +428,7 @@ namespace QFramework.Example SetAllChildren(obj.transform, isOn); obj.SetActive(isOn); }); + bodyToggle.isOn = body.isShow; var iconImg = bodyItem.transform.Find("Icon").GetComponent(); LoadIcon(body.Icon, body, iconImg); } diff --git a/Assets/Scripts/UI/UIBody3DMenuTree.cs b/Assets/Scripts/UI/UIBody3DMenuTree.cs index e47c74c0..4a513713 100644 --- a/Assets/Scripts/UI/UIBody3DMenuTree.cs +++ b/Assets/Scripts/UI/UIBody3DMenuTree.cs @@ -348,6 +348,7 @@ namespace QFramework.Example for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); + Transform subContent = child.Find("SubContent"); Transform labelTransform = child.Find("Content/Toggle/Content/Label"); if (labelTransform != null) { @@ -359,7 +360,6 @@ namespace QFramework.Example { GameObject clone = GameObject.Instantiate(SearchItem.gameObject, SearchContent); searchItemMap.Add(clone, child.gameObject); - Transform subContent = child.Find("SubContent"); Button btn = clone.transform.Find("Button").GetComponent