Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PrefabStage

The PrefabStage class represents an editing context for Prefab Assets.
Read time 5 minutesLast updated 10 days ago

Definition

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

assetPathThe asset path where the Prefab Asset file is stored, relative to the project root.
modeThe Prefab Stage can be opened either in isolation or in context.
openedFromInstanceObjectA GameObject inside the Prefab instance that you opened Prefab Mode through.
openedFromInstanceRootThe root of the Prefab instance that you opened Prefab Mode through.
prefabContentsRootThe root GameObject of the loaded Prefab Asset contents.

Methods

Method

Description

ClearDirtinessClear the dirtyness flag for the Prefab stage.
IsPartOfPrefabContentsReturns true if the given GameObject is part of the loaded Prefab Asset contents in the Prefab stage.

Static Events

Member

Description

prefabSavedCallback that is invoked whenever the contents of a Prefab stage has been saved.
prefabSavingCallback that's invoked whenever the contents of a Prefab stage is about to be saved.
prefabStageClosingCallback that's invoked whenever a Prefab stage is about to be opened.
prefabStageDirtiedCallback that's invoked whenever a Prefab stage changes from unmodified to modified.
prefabStageOpenedCallback that's invoked whenever a Prefab stage has been opened.

Enums

Enum

Description

PrefabStage.ModeSpecifies the mode that Unity uses to open a Prefab stage. You can open the stage either in isolation or in context.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.