Version: 2019.3
Creating Prefabs
Instance overrides

Editing a Prefab in Prefab Mode

To edit a PrefabAn asset type that allows you to store a GameObject complete with components and properties. The prefab acts as a template from which you can create new object instances in the scene. More info
See in Glossary
Asset, open it in Prefab Mode. Prefab Mode allows you to view and edit the contents of the Prefab Asset in isolation, separately from any other objects in your SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
. Changes you make in Prefab Mode affect all instances of that Prefab.

Entering and exiting Prefab Mode

There are many ways to begin editing a Prefab in Prefab Mode, including:

  • Double-clicking it in the Project window
  • Using the arrow button next to the Prefab in the Hierarchy window
  • Clicking the “Open” button in the InspectorA Unity window that displays information about the currently selected GameObject, Asset or Project Settings, alowing you to inspect and edit the values. More info
    See in Glossary
    window of a Prefab Asset
The arrow button next to a Prefab in the Hierarchy window
The arrow button next to a Prefab in the Hierarchy window

Entering Prefab Mode makes the Scene ViewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
See in Glossary
and the Hierarchy window show only the contents of that Prefab. Here, the root of the Prefab is a regular GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
- it doesn’t have the blue Prefab instances icon.

The Scene View and Hierarchy in Prefab Mode
The Scene View and Hierarchy in Prefab Mode

In Prefab Mode, the Scene View displays a breadcrumb bar at the top. The rightmost entry is the currently open Prefab. Use the breadcrumb bar to navigate back to the main Scenes or other Prefab Assets that you might have opened.

The breadcrumb bar at the top of the Scene view, visible when in Prefab Mode
The breadcrumb bar at the top of the Scene view, visible when in Prefab Mode

Additionally, the Hierarchy window displays a Prefab header bar at the top which shows the currently open Prefab. You can use the back arrow in the header bar to navigate back one step, which is equivalent to clicking the previous breadcrumb in the breadcrumb bar in the Scene View.

The back arrow in the header bar of the Hierarchy window, visible when in Prefab Mode
The back arrow in the header bar of the Hierarchy window, visible when in Prefab Mode

Auto Save

Prefab Mode has an Auto Save setting in the top right corner of the Scene View. When it is enabled, any changes that you make to a Prefab are automatically saved to the Prefab Asset. Auto Save is on by default.

The Auto Save toggle in the upper right corner of the Scene View in Prefab Mode
The Auto Save toggle in the upper right corner of the Scene View in Prefab Mode

If you want to make changes without automatically saving those changes to the Preset Asset, turn Auto Save off. In this case, you are asked if you want to save unsaved changes or not when you go out of Prefab Mode for the current Prefab. If editing a Prefab in Prefab Mode seems slow, turning off Auto Save may help.

Undo

When you make changes to a Prefab Asset while in Prefab Mode, you can only undo those changes while still in Prefab Mode. Once you exit Prefab Mode for a given Prefab Asset, your edits relating to that Prefab Asset are no longer available in the undo history.

Editing Environment

You can assign a Scene as an editing environment to Prefab Mode, which allows you to edit your Prefab against a backdrop of your choosing rather than an empty Scene. This can be useful for seeing how your Prefab looks against typical scenery in your game.

The objects in the Scene that you assign as the editing environment are not selectable when in Prefab Mode, nor will they show in the Hierarchy. This is to allow you to focus on editing your Prefab without accidently selecting other unrelated objects, and without having a cluttered Hierarchy window.

To set a Scene as the editing environment, open the Editor window (top menu: Edit > Project Settings, then select the Editor category) and go to the Prefab Editing Environment section. Use the Regular Environment setting for “non-UI” Prefabs, and the UI Environment setting for UI Prefabs. UI prefabs are those Prefabs that have a Rect Transform component on the root, rather than a regular Transform component. “non-UI” Prefabs are those which have a regular Transform component.

Prefab editing environment settings in the Editor Project Settings
Prefab editing environment settings in the Editor Project Settings

  • 2018–07–31 Page published

  • Nested Prefabs and Prefab Variants added in 2018.3

Creating Prefabs
Instance overrides