Utility class for any prefab related operations.
Note: This is an editor class. To use it you have to place your script in Assets/Editor inside your project folder. Editor classes are in the UnityEditor namespace so for C# scripts you need to add "using UnityEditor;" at the beginning of the script.
GetPrefabParent |
Returns the GameObject parent of source, or null if it can't be found. |
GetPrefabObject |
Retrieves the prefab object representation. |
GetPropertyModifications |
Extract all modifications that are applied to the prefab instance compared to the parent prefab. |
SetPropertyModifications |
Assigns 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. |
RecordPrefabInstancePropertyModifications |
Force record property modifications by comparing against the parent prefab. |
MergeAllPrefabInstances |
Force re-merging all prefab instances of this prefab. |
DisconnectPrefabInstance |
Disconnects the prefab instance from its parent prefab. |
InstantiatePrefab |
Instantiates the given prefab. |
CreateEmptyPrefab |
Creates an empty prefab at given path. |
CreatePrefab |
Creates a prefab from a game object hierarchy |
ReplacePrefab |
Replaces the targetPrefab with a copy of the game object hierarchy go. |
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. |
ReconnectToLastPrefab |
Connects the game object to the prefab that it was last connected to. |
ResetToPrefabState |
Resets the properties of the component or game object to the parent prefab state |
IsComponentAddedToPrefabInstance |
|
RevertPrefabInstance |
Resets the properties of all objects in the prefab, including child game objects and components that were added to the prefab instance |
GetPrefabType |
Given an object, returns its prefab type (None, if it's not a prefab) |
FindPrefabRoot |
Helper function to find the prefab root of an object (used for picking niceness) |