Deep Scanner Module
The Scanner is the engine responsible for traversing the Unity project structure and identifying anomalies.
Architecture
The scanner is built on MRK_Scanner.cs and operates in three distinct phases:
Phase 1: Active Scene Analysis
- Iterates over
SceneManager.GetActiveScene()and any loaded additive scenes. - Uses
GameObject.GetComponentsto check for null entries (Missing Scripts). - Uses
SerializedObjectiteration to check every property forobjectReferenceValue == nullwhere theobjectReferenceInstanceIDValue != 0.
Phase 2: Background Scene Traversal
To ensure comprehensive coverage without requiring manuals actions:
- The scanner identifies all
.unityfiles in the project. - It uses
EditorSceneManager.OpenScene(path, OpenSceneMode.Additive)to verify content. - Post-scan, it ensures the scene is closed to maintain a clean workspace.
Phase 3: Asset Analysis
- Prefabs: Loads assets via
AssetDatabase.LoadAssetAtPath<GameObject>and checks recursively. - ScriptableObjects: Scans serialized data for configuration assets.
Performance
The scanner reports progress via EditorUtility.DisplayCancelableProgressBar. For large projects, garbage collection (Resources.UnloadUnusedAssets) is triggered periodically to prevent memory spikes during the scan.