public void InitPanelDetph() { if (null == m_lst_panels) { m_lst_panels = new List <UIPanel>(); List <UIDefine.UIPanelHierarchyData> panelHierarchyData = new List <UIDefine.UIPanelHierarchyData>(); UIPanel panel = CacheTransform.GetComponent <UIPanel>(); if (null != panel) { m_lst_panels.Add(panel); } UIPanelManager.GetPanelHierarchydepth(CacheTransform, 0, ref panelHierarchyData); if (panelHierarchyData.Count > 0) { panelHierarchyData.Sort((left, right) => { return(left.hierachyDepth - right.hierachyDepth); }); for (int i = 0; i < panelHierarchyData.Count; i++) { m_lst_panels.Add(panelHierarchyData[i].panel); } } } }