/
GeekNerd
/
ServerModelingProject
Обзор
Документация
Войти
/
GeekNerd
/
ServerModelingProject
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Assets/Editor/MissingScriptFinder.cs
68 строк
2 KB
Gorney-Alex
Init
30 май 2026, 19:05
30 май 2026, 19:05
3cdcc49
Код
Авторство
О чём код?
using UnityEditor; using UnityEngine; namespace Editor { public class MissingScriptFinder { [MenuItem("Tools/Find Missing Scripts In Project (Detailed)")] public static void FindMissingScriptsInProject() { string[] guids = AssetDatabase.FindAssets("t:Prefab"); int totalMissing = 0; foreach (string guid in guids) { string path = AssetDatabase.GUIDToAssetPath(guid); GameObject prefab = AssetDatabase.LoadAssetAtPath<GameObject>(path); if (prefab == null) continue; CheckGameObject(prefab, path, ref totalMissing); } Debug.Log($"TOTAL Missing Scripts: {totalMissing}"); } private static void CheckGameObject(GameObject obj, string path, ref int totalMissing) { Component[] components = obj.GetComponents<Component>(); for (int i = 0; i < components.Length; i++) { if (components[i] == null) { Debug.LogError( $"Missing Script detected!\n" + $"Prefab: {path}\n" + $"GameObject: {GetFullPath(obj)}\n" + $"Component Index: {i}", obj ); totalMissing++; } } foreach (Transform child in obj.transform) { CheckGameObject(child.gameObject, path, ref totalMissing); } } private static string GetFullPath(GameObject obj) { string path = obj.name; Transform current = obj.transform.parent; while (current != null) { path = current.name + "/" + path; current = current.parent; } return path; } } }