From b5c20ff3c3993531d042c62ab8b723a95cdc4645 Mon Sep 17 00:00:00 2001
From: lwb <q3213421wrwqr>
Date: 星期二, 23 三月 2021 15:50:14 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/snxxz_client

---
 Assets/Editor/Tool/RemoveMissingScripts.cs |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/Assets/Editor/Tool/RemoveMissingScripts.cs b/Assets/Editor/Tool/RemoveMissingScripts.cs
index dcd7697..917c45f 100644
--- a/Assets/Editor/Tool/RemoveMissingScripts.cs
+++ b/Assets/Editor/Tool/RemoveMissingScripts.cs
@@ -52,25 +52,31 @@
             count2++;
             EditorUtility.DisplayProgressBar("Processing...", "閬嶅巻涓㈠け鑴氭湰Prefab涓�....", count / pathList.Count);
             GameObject obj = (GameObject)AssetDatabase.LoadAssetAtPath(path, typeof(GameObject));
-            getAllChild(obj.transform);
+            checkMissing(obj);
+            getAllChild(obj);
         }
         EditorUtility.ClearProgressBar();
     }
 
-    void getAllChild(Transform tf)
+    void getAllChild(GameObject go)
     {
-        foreach (Transform child in tf)
+        foreach (Transform child in go.transform)
         {
-            var components = child.GetComponents<Component>();
-            for (int j = 0; j < components.Length; j++)
+            checkMissing(child.gameObject);
+            getAllChild(child.gameObject);
+        }
+    }
+
+    void checkMissing(GameObject go)
+    {
+        var components = go.GetComponents<Component>();
+        for (int j = 0; j < components.Length; j++)
+        {
+            if (components[j] == null)
             {
-                if (components[j] == null)
-                {
-                    missObj.Add(child.gameObject);
-                    continue;
-                }
+                missObj.Add(go.gameObject);
+                continue;
             }
-            getAllChild(child);
         }
     }
 

--
Gitblit v1.8.0