Broken Reference Scanner
Finds missing object references on scenes, prefabs, and ScriptableObjects under Assets/: SerializedProperty “Missing” refs, UnityEvent persistent calls with a missing target, YAML Unity refs ({fileID, guid, type}) whose guid AssetDatabase cannot resolve, and missing prefab instances. Bare guid: scalars (Bedder BsId stickers) and empty guids are skipped. Package GUIDs that resolve are not flagged.
Editor-only. Unity 2021.3+. Lives in Anvil.Editor (includePlatforms: Editor). No extra packages.
Editor window
ArTchie / Anvil / Broken Reference Scanner
| Button | What it does |
|---|---|
| Scan | Walks every scene, prefab, and ScriptableObject under Assets/ (skips Packages/ and Library/). |
| Copy JSON | Puts the report JSON on the clipboard. |
| Write report | Writes <project>/AnvilReports/broken-refs.json (creates the folder if needed). |
Each row is: assetPath, kind, hierarchy / object path, property path, and guid when the YAML scan found one.
Batchmode (CI)
Unity -batchmode -nographics -quit -projectPath <proj> -executeMethod Anvil.BrokenRefScanner.RunBatch -anvil-out <file.json> -anvil-fail
| Arg | Meaning |
|---|---|
-anvil-out <file.json> |
Output path. Default: <project>/AnvilReports/broken-refs.json |
-anvil-fail |
Exit code 1 if any broken refs were found; otherwise 0 |
RunBatch only calls EditorApplication.Exit when Application.isBatchMode is true. It logs count= and the output path.
Also accepts -anvil-out=file.json.
JSON
{
"tool": "BrokenRefScanner",
"generatedUtc": "2026-08-18T02:00:00Z",
"count": 1,
"items": [
{
"assetPath": "Assets/Scenes/Main.unity",
"kind": "missingRef",
"objectPath": "Player/Weapon:MeshRenderer",
"propertyPath": "m_Materials.Array.data[0]",
"guid": ""
}
]
}
kind values:
| kind | Meaning |
|---|---|
missingRef |
objectReferenceValue == null and objectReferenceInstanceIDValue != 0 |
unityEvent |
Persistent call m_Target is Missing, or null with a leftover m_MethodName |
yaml |
Brace {fileID, guid, type} object with a 32-hex guid that GUIDToAssetPath cannot resolve. Bare guid: scalars and empty guids are not this kind. |
prefabInstance |
PrefabUtility.IsPrefabAssetMissing on a GameObject |
guid is filled for yaml hits. SerializedProperty hits usually have guid "" (Unity does not expose the missing object’s guid on the property).
Notes
- Prefabs:
PrefabUtility.LoadPrefabContents/UnloadPrefabContents. - Scenes: additive open+close in the Editor window (restores your previous setup);
OpenSceneMode.Singlein batch. - ScriptableObjects:
t:ScriptableObjectunderAssets/, including sub-assets; scene/prefab-embedded SOs are covered by the hierarchy walk. - YAML pass matches
{fileID, guid, type}objects only (GuidWithKeyRe). Bareguid: <hex>scalars (BedderScriptBsId.guidsticker strings) are never extracted. - Empty / zero-length guids are skipped.
- Built-in Unity GUIDs (
0000000000000000…and all-zero) are not flagged as dangling. - Resolvable package GUIDs (
AssetDatabase.GUIDToAssetPathnon-empty) are not flagged. - Binary-serialized scenes/prefabs still report SerializedProperty misses; YAML
{fileID, guid, type}scan may miss those files. - Empty (None) references with instance ID
0are not reported. - Empty projects and a missing
AnvilReportsfolder are fine. - Does not repair references. Does not touch runtime player code.
Source in the box: Assets/ArTchie Studios/ArTchie-Suite/com.artchie.anvil/Documentation/BrokenRefScanner.md