diff --git a/UniVue/Runtime/View/ViewBuilder.cs b/UniVue/Runtime/View/ViewBuilder.cs index 9351f72..5a1b6e6 100644 --- a/UniVue/Runtime/View/ViewBuilder.cs +++ b/UniVue/Runtime/View/ViewBuilder.cs @@ -74,11 +74,14 @@ public static void Build(GameObject canvas, ViewConfig[] viewConfigs) KeepNested(config); } - //4. 按order层级进行排序 + //4. 按order层级进行排序 : 只对根视图执行排序操作 roots.Sort((r1, r2) => r1.Item1.order - r2.Item1.order); //升序排序,因为order值越大越先被渲染 for (int i = 0; i < roots.Count; i++) { - roots[i].Item2.transform.SetAsLastSibling(); + if (roots[i].Item3 == 0) + { + roots[i].Item2.transform.SetAsLastSibling(); + } } //5.调用OnLoad()函数 @@ -114,7 +117,7 @@ private static void FindNestedViewObject(List viewNames) && !viewNames.Contains(viewName)) viewNames.Add(viewName); - else if(viewNames == null) + else if (viewNames == null) _models.Add(model, new List(1) { viewName }); }