Scene and Prefab Edits
Select the intended Editor before editing. Verify the loaded scene, object identity and destination asset path. The JSON examples on the linked tool pages are request arguments; replace project paths, object IDs and returned tokens with values from that Editor.
Preview scene properties and hierarchy
Use manage_scene_edits in Edit Mode.
Its property example moves an existing Player Transform, matching the
scene-edit workflow.
Inspect the returned before/after values before calling apply with its preview_id. The token is
valid for ten minutes and one attempt; drift, expiry or a failed attempt requires a new preview.
Do not send the token and the original edit list together. Direct property apply instead requires
expected_old on every edit.
Structural previews use an integer ID for a scene-root scope and ordered operations. The example
creates a Transform-only child, then a grandchild using an earlier temporary ID. Only ordinary
Transform-only subtrees are supported; prefab instances and objects with other components are
refused. Inspect the preview and pass its token to apply_structure. Each successful apply records
one named Undo group. Save the scene explicitly after reviewing the result; Undo does not provide
filesystem or callback rollback.
Undo a property edit after further editing
Keep the receipt_id from a successful property apply or prefab apply_preview.
In the same Editor, invoke manage_scene_edits with
{"action":"undo","receipt_id":"YOUR_RECEIPT"}, or run
unity-mcp scene-edit undo YOUR_RECEIPT. The Editor retains its last 32 unconsumed
receipts until an assembly reload or restart. Each receipt allows one undo attempt.
For example, after MCP changes a prefab's scale, a teammate can move the prefab asset
and edit its position. Undo resolves the asset by GUID, verifies its original root
identity and restores only the scale. If the teammate also changed the scale, the
response lists its before, applied and current values in conflicts.
The teammate's value survives. Other eligible fields are restored and counted in
restored, even when the response reports property_undo_conflict. That response
includes a fresh remaining_receipt_id covering only the conflicted fields. Use it
after resolving a conflict if you want to recheck those fields. A field already
at its original value needs no write. Prefab recovery saves the current source with
these field edits. Scene recovery needs the original live components, creates its
own Unity Undo group and leaves scene saving explicit. Structural edits and indexed
collection elements are outside the property receipt contract.
Create a prefab from one object
prefab_create creates an asset from an
existing scene or prefab-stage object. Use a verified integer instance ID or an unambiguous full
hierarchy path. Numeric strings also mean instance IDs. Current prefab-stage names and paths take
precedence over the active scene, so an ID is preferable when both contain similarly named objects.
Choose a new path such as Assets/Prefabs/Crate.prefab. allow_overwrite defaults to false. If the selected object
belongs to a prefab instance, review its exact unpack scope before opting into unlink_if_instance;
the selected object must be its outermost instance root. A nested object cannot authorize unpacking
its outer instance and siblings. After a failed save, inspect the returned error and the scene and
destination before retrying. If unpacking occurred, the error advises Undo if available or manual
restoration. Retain the source object until the saved asset is verified.
The result includes rootObjectName and rootObjectPath from the saved asset, whose root name can
differ from the scene instance. Use those values for later asset edits, or omit target to edit the
asset root. Scene instance IDs do not select objects inside isolated prefab contents.
Preview changes to an existing prefab
prefab_contents offers a guarded root
Transform/active-state preview and token apply. The example uses preview_modify_contents and
apply_preview. This route accepts supported prefabs without nested instances or custom components;
it rejects source or dependency drift before saving. The apply token is valid for ten minutes and
one attempt. Supply only that token and the action to apply it.
For broader component or child edits, modify_contents with preview_only: true inspects isolated
contents without saving. That preview returns no apply token. Inspect its unsupported fields and
truncation indicators, then review a separate save request; save callbacks and a later run may differ.
Prefab asset saves do not promise Undo or rollback of callback side effects. See the
legacy prefab examples for returned-root
targeting and the full compatibility surface.
Save a scene to another path
manage_scene saves the active scene normally
when no other destination is selected. Save As to another existing scene requires
allow_overwrite: true after reviewing that destination. The CLI equivalent is
unity-mcp scene save --path Assets/Scenes/Existing.unity --allow-overwrite.