Prefabs and Multi-Editing
Prefabs turn a GameObject hierarchy into reusable project content. Multi-editing applies the same safe change to several selected GameObjects. Together they are the recommended way to build repeated doors, lights, interaction setups, environment modules, and gameplay props without maintaining disconnected copies.
Select More Than One GameObject
Use the Hierarchy to build a selection:
- Ctrl-click adds or removes one GameObject.
- Shift-click selects the contiguous range from the selection anchor.
- Clicking without a modifier replaces the current selection.
The Inspector reports mixed values instead of silently choosing one. Editing Position, Rotation, or Scale applies the entered value to every selected GameObject. Enable All and Disable All update the active state as a single undoable operation.
When every selected GameObject has the same supported component, the Batch Components section can enable or disable that component for the selection. The current batch controls cover Player Input, Player Motor, Interactable, and Camera Rig. Add Collider to Missing adds a fitted Collider only where one does not already exist.
Duplicate Selected and Delete Selected operate on selection roots. If both a parent and its child are selected, the hierarchy is processed once from the parent. Duplicate remaps internal GameObject references so the copied subtrees continue to refer to their copied members.
Create a Prefab
- Select the root of the hierarchy you want to reuse.
- Right-click it in the Hierarchy and choose Create Prefab....
- Enter a valid asset name.
- Save the scene.
The editor writes Assets/Prefabs/<name>.prefab.json. The selected hierarchy
becomes a linked instance immediately. A prefab stores the complete subtree
with stable local IDs, which lets the editor preserve references between its
children when it is instantiated or synchronized.
Instantiate a Prefab
Find the prefab under Assets/Prefabs in the Project Browser and drag it:
- onto the scene root to create a root instance; or
- onto a GameObject to create a child instance.
The new hierarchy receives scene-unique GameObject IDs while retaining its prefab-local identity. The Inspector shows the source path and prefab actions for the instance root and its children.
Sync, Apply, and Unpack
| Action | Result |
|---|---|
| Sync / Sync from Source | Rebuilds the instance from the prefab source while preserving the instance root Transform and exposed Lua property overrides. |
| Apply / Apply to Source | Writes the selected instance hierarchy back to the prefab asset atomically. Other instances update when they are synchronized. |
| Unpack | Removes the prefab link but keeps the complete GameObject hierarchy in the scene. |
Use Sync after changing a prefab through another instance or checkout. Use Apply only when the selected instance represents the reusable source you intend to publish. Use Unpack when a copy should permanently diverge.
Scene-specific root placement is intentionally not pulled from the prefab during synchronization. Exposed Lua values on the instance root are also kept as overrides, so reusable behavior can have per-instance tuning.
Moving or Deleting a Prefab
Moving a prefab inside the Project Browser updates links in the open scene. Deleting a prefab is guarded more strongly:
- the editor loads the prefab before deletion;
- every authored scene is scanned for linked instances;
- linked instances are unpacked without deleting their GameObjects;
- affected scene files are written transactionally; and
- the operation rolls back if any referencing scene cannot be updated.
This protects scene content, but source control is still the recovery path for an unwanted Apply or deletion after the transaction succeeds.
Recommended Workflow
- Keep a prefab focused on one reusable responsibility.
- Put intentional per-instance values in exposed Lua properties rather than editing the prefab structure in every scene.
- Apply from a reviewed representative instance, then synchronize other instances.
- Validate the project after moving, renaming, or deleting shared content.
- Commit prefab and scene changes together so links remain coherent for other developers.
Undo and scene metadata
Scene Undo/Redo snapshots include scene-level fog, loading presentation,
canvases, timelines, animations, and object data. A sequence of object edits
must not discard unrelated scene metadata when traversing history. Level
Builder has its own mesh history; Edit menu and toolbar Undo/Redo target it
when that workspace owns the edit context. Ctrl+S saves both scene/project
data and dirty Level Builder meshes.