PrefabStage
The PrefabStage class represents an editing context for Prefab Assets.
Read time 5 minutesLast updated 10 days ago
Definition
- Type: Class
- Namespace: UnityEditor.SceneManagement
- Assembly: UnityEditor.CoreModule
- Inherits from: PreviewSceneStage
public sealed class PrefabStage : PreviewSceneStage
Remarks
A stage is an editing context which includes a collection of Scenes. The main stage contains all the currently open regular Scenes, while a Prefab stage contains a preview Scene used solely for editing the Prefab in.
The breadcrumbs which are shown in the Scene view when in Prefab Mode each represent a stage. Those with a Prefab icon represent Prefab stages.
Properties
Property | Description |
|---|---|
| assetPath | The asset path where the Prefab Asset file is stored, relative to the project root. |
| mode | The Prefab Stage can be opened either in isolation or in context. |
| openedFromInstanceObject | A GameObject inside the Prefab instance that you opened Prefab Mode through. |
| openedFromInstanceRoot | The root of the Prefab instance that you opened Prefab Mode through. |
| prefabContentsRoot | The root GameObject of the loaded Prefab Asset contents. |
Methods
Method | Description |
|---|---|
| ClearDirtiness | Clear the dirtyness flag for the Prefab stage. |
| IsPartOfPrefabContents | Returns true if the given GameObject is part of the loaded Prefab Asset contents in the Prefab stage. |
Static Events
Member | Description |
|---|---|
| prefabSaved | Callback that is invoked whenever the contents of a Prefab stage has been saved. |
| prefabSaving | Callback that's invoked whenever the contents of a Prefab stage is about to be saved. |
| prefabStageClosing | Callback that's invoked whenever a Prefab stage is about to be opened. |
| prefabStageDirtied | Callback that's invoked whenever a Prefab stage changes from unmodified to modified. |
| prefabStageOpened | Callback that's invoked whenever a Prefab stage has been opened. |
Enums
Enum | Description |
|---|---|
| PrefabStage.Mode | Specifies the mode that Unity uses to open a Prefab stage. You can open the stage either in isolation or in context. |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |