Example #1
0
        //获取ui实际输出的预制列表(有export标记的独立输出)
        static List <GameObject> GetPrefabList(GameObject root, string parentPanelName)
        {
            string export_flag = "export";

            List <GameObject> ret = new List <GameObject>();

            ret.Add(root);  //默认添加根对象

            List <GameObject> toExport = new List <GameObject>();

            GameObjUtil.FuzzySearchChildren(root, export_flag, ref toExport);  //名称有export就是额外导出
            //toExport.Clear();
            foreach (GameObject go in toExport)
            {
                int start = go.name.IndexOf(export_flag);  //Container_exportPart2

                //string name = go.name.Substring(0, start) + go.name.Substring(start + 6) + "__" + parentPanelName;
                string name = parentPanelName + "__" + go.name.Substring(0, start) + go.name.Substring(start + export_flag.Length);  //Canvas_Bag__Container_Part2
                go.name = name;
                ret.Add(go);
            }
            return(ret);
        }