diff --git a/Assets/Scenes/Test.unity b/Assets/Scenes/Test.unity index 0ec35d1a..324268b8 100644 --- a/Assets/Scenes/Test.unity +++ b/Assets/Scenes/Test.unity @@ -9990,7 +9990,7 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 296163866} - m_Enabled: 0 + m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 1f127f2bf137e12439e2b140488ef479, type: 3} m_Name: diff --git a/Assets/Scripts/UI/UIBody3D.cs b/Assets/Scripts/UI/UIBody3D.cs index ca4d8b1d..544bb8d3 100644 --- a/Assets/Scripts/UI/UIBody3D.cs +++ b/Assets/Scripts/UI/UIBody3D.cs @@ -40,8 +40,15 @@ namespace QFramework.Example { string name = bodys[index]; var body = root.subBody[name]; - Utility.FindObj(body.Path)?.SetActive(true); - index++; + var obj = Utility.FindObj(body.Path); + if (obj!=null) + { + foreach (var item in obj.GetComponentsInChildren(true)) + { + item.gameObject.SetActive(true); + } + index++; + } } } @@ -49,10 +56,17 @@ namespace QFramework.Example { if (index > 0) { - index--; string name = bodys[index]; var body = root.subBody[name]; - Utility.FindObj(body.Path)?.SetActive(false); + var obj = Utility.FindObj(body.Path); + if (obj!=null) + { + foreach (var item in obj.GetComponentsInChildren(true)) + { + item.gameObject.SetActive(false); + } + index--; + } } } }