Unity Prefab Guide
Unity Nested Prefabs Explained: Overrides, References, and Merge Conflicts
Nested prefabs are powerful because they let teams compose reusable prefab assets. They are risky in review because one visible change can involve several layers of ownership: the outer prefab, the nested prefab, local overrides, source-prefab references, and serialized YAML identity.
A mental model for nested prefabs
Think of a nested prefab as two relationships at the same time:
- It belongs to the outer prefab structure.
- It still points back to its own source prefab asset.
That means a reviewer cannot inspect only the local YAML lines. They need to know whether the change belongs to the outer prefab, the nested prefab source, an instance override, a prefab variant layer, or a reference between those layers.
How nested prefabs interact with overrides
Nested prefabs often appear in review because somebody added a prefab instance inside another prefab or changed a property on a nested object. Unity can treat these as overrides depending on where the edit was made and whether the change has been applied to the outer prefab asset.
The practical risk is that "apply this override" is not always a simple idea. In multi-level prefab setups, the team may need to choose whether a change belongs to the nested prefab source, the outer prefab, or a local instance.
Raw YAML signals reviewers should recognize
Nested prefab changes often surface as PrefabInstance, m_Modification, source prefab references, stripped objects, and GUID/fileID pairs. A simplified YAML fragment can look like this:
--- !u!1001 &9900112233
PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: a1b2c3d4..., type: 3}
m_Modification:
m_Modifications:
- target: {fileID: 4455667788, guid: a1b2c3d4..., type: 3}
propertyPath: m_Name
value: Door_Blue
As Unity meaning, that might be: the outer prefab contains a nested door prefab, and this instance overrides the nested door's name or property. The important review question is not "did a YAML value change?" It is "which prefab layer owns this override, and should this local difference survive the merge?"
Why nested prefab merge conflicts are risky
Nested prefab conflicts become risky when branches change different layers of the same relationship. Common examples:
- One branch edits the nested prefab source while another branch edits an override on an outer prefab instance.
- One branch adds a nested prefab while another branch changes sibling order or parent hierarchy.
- One branch changes a reference inside the nested prefab while another branch replaces the referenced asset.
- One branch applies an override to the outer prefab while another branch keeps it as a local instance override.
- One branch removes a nested object while another branch edits a component on that object.
These conflicts are not equal. Some are ordinary property conflicts. Some are ownership conflicts. Some are reference integrity conflicts. Treating all of them as line conflicts hides the decision the reviewer actually needs to make.
Nested prefab review checklist
Before accepting a nested prefab change, check:
- Which prefab asset is the source of the nested instance?
- Was the nested prefab added as an override or applied into the outer prefab asset?
- Which object path and component path changed?
- Did the change alter a reference, GUID, fileID, material, script, or prefab source?
- Does the same change need to live in the nested source prefab, the outer prefab, or a local instance?
- Did the merge create missing scripts, dangling references, or stale overrides?
Where semantic review helps
A useful review should present nested prefab changes as Unity structure: outer prefab path, nested prefab source, affected GameObject, component, property path, reference target, and validation warnings. That is much more useful than raw m_Modification blocks when a merge decision is risky.
MergeSight is designed around that kind of semantic Unity review: it turns scene and prefab YAML into object-level context, highlights references and prefab overrides, and supports safer 3-way merge workflows.
FAQ
What are Unity nested prefabs?
They are prefab instances placed inside other prefab assets. The nested prefab keeps a link to its own source prefab while also becoming part of the outer prefab asset.
Why are nested prefabs hard to merge?
Because branches can edit different layers of the same relationship: outer prefab, nested source prefab, local override, reference target, or apply target.
Are nested prefab changes the same as prefab overrides?
Not always. A nested prefab can be part of a prefab asset, or it can appear as an added override on an instance before being applied. The distinction matters during review and merge.
What should reviewers check first?
Start with ownership: which prefab layer owns the change? Then check object path, component path, references, and whether the change was applied or remains an override.
Summary
Unity nested prefabs are prefab instances placed inside other prefab assets. They retain links to their own prefab assets while also becoming part of an outer prefab. This is useful for composition, but it makes review and merge harder because overrides and references can exist at more than one prefab level.
Summary
Nested prefab
A prefab instance stored inside another prefab asset while keeping its own source link.
Review problem
The same local edit can affect source links, overrides, references, and apply targets.
Merge risk
Branches can change different prefab layers and still collide semantically in YAML.
Nested prefab review is mostly about answering: which layer owns this change?
Next step
If nested prefabs are causing merge pain, continue with Unity Prefab Merge Conflicts and Unity Prefab Overrides Explained. If the problem shows up as raw YAML noise, see Unity YAML Merge.