From 7003fc038ce86a12eac495aa08260bceae7ab3e4 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Thu, 17 Apr 2025 11:41:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIBody3D.cs | 2 +- Assets/Scripts/UI/UIBody3DMenuTree.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) 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