diff --git a/Assets/Scripts/UI/UIBody3D.cs b/Assets/Scripts/UI/UIBody3D.cs index 544bb8d3..d7703b82 100644 --- a/Assets/Scripts/UI/UIBody3D.cs +++ b/Assets/Scripts/UI/UIBody3D.cs @@ -48,13 +48,17 @@ namespace QFramework.Example item.gameObject.SetActive(true); } index++; + if (index >= bodys.Count) + { + index = bodys.Count - 1; + } } } } public void Sub() { - if (index > 0) + if (index >= 0) { string name = bodys[index]; var body = root.subBody[name]; @@ -66,6 +70,10 @@ namespace QFramework.Example item.gameObject.SetActive(false); } index--; + if (index < 0) + { + index = 0; + } } } }