Version: 2017.3 (switch to 2018.1b)
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.


class in UnityEditor

Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.




Utility class for any prefab related operations.

Static Properties

prefabInstanceUpdatedCalled after prefab instances in the scene have been updated.

Static Methods

ConnectGameObjectToPrefabConnects the source prefab to the game object.
CreateEmptyPrefabCreates an empty prefab at given path.
CreatePrefabCreates a prefab from a game object hierarchy.
DisconnectPrefabInstanceDisconnects the prefab instance from its parent prefab.
FindPrefabRootHelper function to find the prefab root of an object (used for picking niceness).
FindRootGameObjectWithSameParentPrefabReturns the topmost game object that has the same prefab parent as target.
FindValidUploadPrefabInstanceRootReturns root game object of the prefab instance if that root prefab instance is a parent of the prefab.
GetPrefabObjectRetrieves the enclosing prefab for any object contained within.
GetPrefabParentReturns the parent asset object of source, or null if it can't be found.
GetPrefabTypeGiven an object, returns its prefab type (None, if it's not a prefab).
GetPropertyModificationsExtract all modifications that are applied to the prefab instance compared to the parent prefab.
InstantiateAttachedAssetInstantiate an asset that is referenced by a prefab and use it on the prefab instance.
InstantiatePrefabInstantiates the given prefab in a given scene.
MergeAllPrefabInstancesForce re-merging all prefab instances of this prefab.
ReconnectToLastPrefabConnects the game object to the prefab that it was last connected to.
RecordPrefabInstancePropertyModificationsCauses modifications made to the Prefab instance to be recorded.
ReplacePrefabReplaces the targetPrefab with a copy of the game object hierarchy go.
ResetToPrefabStateResets the properties of the component or game object to the parent prefab state.
RevertPrefabInstanceResets the properties of all objects in the prefab, including child game objects and components that were added to the prefab instance.
SetPropertyModificationsAssigns all modifications that are applied to the prefab instance compared to the parent prefab.


PrefabInstanceUpdatedDelegate for method that is called after prefab instances in the scene have been updated.

Did you find this page useful? Please give it a rating: