Language: English
  • C#
  • JS
  • Boo

Script language

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


Namespace: 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.


Sumbission failed

For some reason your suggested change could not be submitted. Please try again 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 Variables

prefabInstanceUpdated Called after prefab instances in the scene have been updated.

Static Functions

CreateEmptyPrefab Creates an empty prefab at given path.
CreatePrefab Creates a prefab from a game object hierarchy.
DisconnectPrefabInstance Disconnects the prefab instance from its parent prefab.
FindPrefabRoot Helper function to find the prefab root of an object (used for picking niceness).
FindRootGameObjectWithSameParentPrefab Returns the topmost game object that has the same prefab parent as target.
FindValidUploadPrefabInstanceRoot Returns root game object of the prefab instance if that root prefab instance is a parent of the prefab.
GetPrefabObject Retrieves the enclosing prefab for any object contained within.
GetPrefabParent Returns the GameObject parent of source, or null if it can't be found.
GetPrefabType Given an object, returns its prefab type (None, if it's not a prefab).
GetPropertyModifications Extract all modifications that are applied to the prefab instance compared to the parent prefab.
InstantiateAttachedAsset Instantiate an asset that is referenced by a prefab and use it on the prefab instance.
InstantiatePrefab Instantiates the given prefab.
MergeAllPrefabInstances Force re-merging all prefab instances of this prefab.
ReconnectToLastPrefab Connects the game object to the prefab that it was last connected to.
RecordPrefabInstancePropertyModifications Force record property modifications by comparing against the parent prefab.
ReplacePrefab Replaces the targetPrefab with a copy of the game object hierarchy go.
ResetToPrefabState Resets the properties of the component or game object to the parent prefab state.
RevertPrefabInstance Resets the properties of all objects in the prefab, including child game objects and components that were added to the prefab instance.
SetPropertyModifications Assigns all modifications that are applied to the prefab instance compared to the parent prefab.