From 904cb38fe76c2ecd8ff5a46595c00b4997694fd5 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期五, 26 四月 2019 10:50:05 +0800
Subject: [PATCH] 3335 ui管理

---
 Assets/Editor/Tool/PrefabHelper.cs |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/Assets/Editor/Tool/PrefabHelper.cs b/Assets/Editor/Tool/PrefabHelper.cs
index 418c7e6..60fc527 100644
--- a/Assets/Editor/Tool/PrefabHelper.cs
+++ b/Assets/Editor/Tool/PrefabHelper.cs
@@ -19,12 +19,20 @@
             {
                 if (!string.IsNullOrEmpty(loader.prefabName))
                 {
-                    var find = loader.transform.Find(loader.prefabName);
-                    if (find)
+                    var children = new List<Transform>();
+                    for (int i = 0; i < loader.transform.childCount; i++)
                     {
-                        GameObject.DestroyImmediate(find.gameObject, true);
-                        EditorUtility.SetDirty(loader.gameObject);
-                        dirty = true;
+                        children.Add(loader.transform.GetChild(i));
+                    }
+
+                    for (int i = children.Count - 1; i >= 0; i--)
+                    {
+                        if (children[i].name == loader.prefabName)
+                        {
+                            GameObject.DestroyImmediate(children[i].gameObject, true);
+                            EditorUtility.SetDirty(loader.gameObject);
+                            dirty = true;
+                        }
                     }
                 }
             }

--
Gitblit v1.8.0