| | |
| | | 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); |
| | | } |
| | | } |
| | | |