Unity Merge Recovery

Unity Scene or Prefab Won't Open After a Git Merge

A recovery guide for diagnosing and repairing a Unity scene or prefab that fails to open after a Git merge.

Alexandr Rice Follow on X Updated August 27, 2026 4 min read Troubleshooting

First response checklist

If a scene or prefab will not open after a Git merge, stop before saving it. Preserve the failed result and every merge contributor. Read the first Console error, check markers and serialization headers, then compare with the last good revision.

  1. Create a recovery branch or copy before changing the broken asset.
  2. Record the merge commit, parent commits, Unity version, and first Console error.
  3. Do not repeatedly open and save the asset in different Unity versions.
  4. Search for conflict markers in all changed Unity text assets.
  5. Compare the file with its last known good revision.
  6. Restore the minimum valid base and reapply reviewed changes if necessary.

Classify the failure

SymptomLikely causeFirst action
Seems to have merge conflictsMarker lines remainSearch and resolve every conflict block.
YAML/parser errorMalformed, truncated, or unsupported serialized textInspect the first reported line and compare contributors.
Serialized file version errorWrong Unity version or damaged headerOpen with the project version and compare the header with a good asset.
Scene opens empty/partialObjects were dropped or references/roots changedCompare semantic object and hierarchy changes.
Prefab has missing scriptsScript GUID/meta mismatch or removed scriptResolve the m_Script target and related meta history.

Check for unresolved merge markers

git grep -n -e '^<<<<<<< ' -e '^=======$' -e '^>>>>>>> ' -- \
  'Assets/*.unity' 'Assets/*.prefab' 'Assets/*.asset' 'Assets/*.mat'

Also inspect the staged version with git show :path/to/asset during an active merge. A working-tree fix is not enough if an earlier staged copy still contains the broken result.

Compare with the last good asset

git log --follow -- Assets/Scenes/World.unity
git show <good-commit>:Assets/Scenes/World.unity > /tmp/World.good.unity
git diff <good-commit> HEAD -- Assets/Scenes/World.unity

Do not overwrite the broken file immediately. Use the good copy as a reference to identify missing document headers, lost roots, deleted objects, changed script GUIDs, and invalid references.

Recover intended Unity structure

MergeSight merge-result review and recovery can compare the last good revision, branch contributors, and proposed result as Unity objects, hierarchy, components, properties, overrides, GUIDs, fileIDs, and references. If a true 3-way state is available, keep unresolved choices explicit and preview before writing.

When the merged file is too malformed to parse, restore a valid side or last-good revision, then reapply only the reviewed changes in Unity. A smaller reconstruction is safer than hand-repairing a large unknown YAML structure.

Check scripts and references

  • Every m_Script GUID resolves to the intended script meta file.
  • Moved or renamed assets kept their original meta files.
  • Local fileID references point to objects that still exist in the file.
  • Prefab source GUIDs and source object fileIDs remain valid.
  • Scene root and Transform parent relationships remain complete.
  • Materials and ScriptableObjects reference existing assets.

Validate the recovered result

  1. Open the project in the exact Unity version declared by ProjectVersion.txt.
  2. Allow import to complete and address the first serialization error before secondary errors.
  3. Open the asset and inspect hierarchy, prefab links, missing scripts, and references.
  4. Save to a recovery branch and review the resulting diff.
  5. Run targeted tests, play paths, and builds.
  6. Add marker and structural checks to CI before merging the recovery.

Avoid destructive shortcuts

  • Do not choose complete Ours or Theirs without inventorying lost work.
  • Do not delete .meta files to force Unity to reimport assets with new GUIDs.
  • Do not open and save through multiple Unity versions hoping one repairs the file.
  • Do not rewrite shared branch history without explicit team coordination.
  • Do not accept an empty scene as a valid recovery because the parser error disappeared.

FAQ

Why won't my Unity scene open after a Git merge?

Common causes are unresolved conflict markers, malformed or truncated YAML, wrong serialized file headers, missing script GUIDs, broken references, or lost scene roots and hierarchy records.

Should I restore Ours or Theirs for a broken Unity scene?

Only after identifying what work the other side contains. Preserve all contributors first, then restore a valid base and reapply intended changes if direct repair is unsafe.

Can deleting the Library folder fix a broken merged scene?

Deleting Library can rebuild import caches, but it does not repair malformed source YAML, missing meta files, conflict markers, or wrong references. Preserve the source problem and diagnose it first.

How do I recover a Unity prefab with missing scripts after merge?

Resolve each m_Script GUID against tracked script meta files, restore moved or deleted meta files where appropriate, compare with the last good prefab, and validate representative instances in Unity.

Try MergeSight

Review the Unity change, not the YAML noise

After preserving the failed result and contributors, use MergeSight to inspect structural decisions, preview recovery, and validate the asset.

Get it on the Asset Store See how MergeSight works