Unity-Technologies/UnityCsReference · error · ArgumentException
Can't save Prefab instance with missing asset and scene back
Error message
Can't save Prefab instance with missing asset and scene backup as a Prefab. You may unpack the instance and save the unpacked GameObjects as a Prefab.
What it means
Thrown when the instanceRoot is part of a non-asset Prefab instance whose source asset has been deleted (IsPrefabAssetMissing) AND there is no CorrespondingObject info available (merge status is not NormalMerge or MergedAsMissingWithSceneBackup). Without corresponding-object info, Unity cannot reconstruct the instance when saving it back as a Prefab.
Source
Thrown at Editor/Mono/Prefabs/PrefabUtility.cs:2086
}
}
private static void SaveAsPrefabAssetArgumentCheck(GameObject instanceRoot, string path, bool connectToInstance)
{
if (instanceRoot == null)
throw new ArgumentNullException("Parameter root is null");
if (EditorUtility.IsPersistent(instanceRoot) && connectToInstance)
throw new ArgumentException("Can't save persistent Objects and connect them to the saved Prefab");
if (IsPartOfNonAssetPrefabInstance(instanceRoot))
{
// A PrefabInstance with missing asset can be correctly restored only if CorrespondingObjects info is available
// CorrespondingObject info is available when a PrefabInstance with missing asset was merged before deleting the asset (kNormalMerge) or when it has a scene backup (kMergedAsMissingWithSceneBackup)
var mergeStatus = GetMergeStatus(instanceRoot);
var hasCorrespondingSourceObjectInfo = mergeStatus == MergeStatus.NormalMerge || mergeStatus == MergeStatus.MergedAsMissingWithSceneBackup;
if (IsPrefabAssetMissing(instanceRoot) && !hasCorrespondingSourceObjectInfo)
throw new ArgumentException("Can't save Prefab instance with missing asset and scene backup as a Prefab. You may unpack the instance and save the unpacked GameObjects as a Prefab.");
}
var actualInstanceRoot = GetOutermostPrefabInstanceRoot(instanceRoot);
if (actualInstanceRoot)
{
if (actualInstanceRoot != instanceRoot)
throw new ArgumentException("Can't save part of a Prefab instance as a Prefab");
}
ValidatePath(instanceRoot, path);
}
private static void ReplacePrefabArgumentCheck(GameObject root, string path)
{
if (root == null)
throw new ArgumentNullException("Parameter root is null");
ValidatePath(root, path);View on GitHub (pinned to 225b0fbdb5)
Solutions
- Unpack the instance: PrefabUtility.UnpackPrefabInstance(instanceRoot, PrefabUnpackMode.Completely, InteractionMode.UserAction); then save the unpacked GameObjects as a new Prefab.
- Restore the missing .prefab asset (from version control or backup) so the instance resolves again.
- Audit scenes for missing-Prefab instances after deleting assets using FindObjectsOfType and IsPrefabAssetMissing.
Example fix
// before
PrefabUtility.SaveAsPrefabAsset(missingInstanceRoot, "Assets/Rebuilt.prefab");
// after
PrefabUtility.UnpackPrefabInstance(missingInstanceRoot,
PrefabUnpackMode.Completely, InteractionMode.UserAction);
PrefabUtility.SaveAsPrefabAsset(missingInstanceRoot, "Assets/Rebuilt.prefab"); Defensive patterns
Strategy: validation
Validate before calling
void SaveOrUnpackMissing(GameObject go, string path)
{
if (PrefabUtility.IsPartOfNonAssetPrefabInstance(go) &&
PrefabUtility.IsPrefabAssetMissing(go))
{
var status = PrefabUtility.GetMergeStatus(go);
bool hasInfo = status == MergeStatus.NormalMerge ||
status == MergeStatus.MergedAsMissingWithSceneBackup;
if (!hasInfo)
{
PrefabUtility.UnpackPrefabInstance(go,
PrefabUnpackMode.Completely, InteractionMode.UserAction);
}
}
PrefabUtility.SaveAsPrefabAsset(go, path);
} Type guard
static bool IsMissingInstanceRecoverable(GameObject go)
{
if (!PrefabUtility.IsPrefabAssetMissing(go)) return true;
var s = PrefabUtility.GetMergeStatus(go);
return s == MergeStatus.NormalMerge ||
s == MergeStatus.MergedAsMissingWithSceneBackup;
} Prevention
- Before deleting a Prefab asset, unpack all its scene instances.
- Audit scenes with IsPrefabAssetMissing after asset deletions.
- Restore missing Prefabs from version control rather than forcing saves.
When it happens
Trigger: A Prefab instance in a scene whose source .prefab asset was deleted. The instance was not properly merged or backed up before deletion, so it has no corresponding source references to map overrides against.
Common situations: A teammate deleted a Prefab asset but left scene instances referencing it. Deleting a Prefab from the project without first unpacking all its instances. Git merge or asset migration that drops a .prefab file while scenes still reference it.
Related errors
- Parameter root is null
- Can't save persistent Objects and connect them to the saved
- Can't save part of a Prefab instance as a Prefab
- PrefabFamilyPopup is already open
- guid
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/8d1e9f9b9b606231.
Report an issue: GitHub.