Class PrefabUtility
Inheritance
PrefabUtility
Assembly: UnityEditor.dll
Syntax
public sealed class PrefabUtility
Fields
|
Improve this Doc
View Source
prefabInstanceUpdated
Declaration
public static PrefabUtility.PrefabInstanceUpdated prefabInstanceUpdated
Field Value
Methods
|
Improve this Doc
View Source
ApplyAddedComponent(Component, String, InteractionMode)
Declaration
public static void ApplyAddedComponent(Component component, string assetPath, InteractionMode action)
Parameters
|
Improve this Doc
View Source
ApplyAddedGameObject(GameObject, String, InteractionMode)
Declaration
public static void ApplyAddedGameObject(GameObject gameObject, string assetPath, InteractionMode action)
Parameters
|
Improve this Doc
View Source
ApplyObjectOverride(Object, String, InteractionMode)
Declaration
public static void ApplyObjectOverride(Object instanceComponentOrGameObject, string assetPath, InteractionMode action)
Parameters
|
Improve this Doc
View Source
ApplyPrefabInstance(GameObject, InteractionMode)
Declaration
public static void ApplyPrefabInstance(GameObject instanceRoot, InteractionMode action)
Parameters
|
Improve this Doc
View Source
ApplyPropertyOverride(SerializedProperty, String, InteractionMode)
Declaration
public static void ApplyPropertyOverride(SerializedProperty instanceProperty, string assetPath, InteractionMode action)
Parameters
|
Improve this Doc
View Source
ApplyRemovedComponent(GameObject, Component, InteractionMode)
Declaration
public static void ApplyRemovedComponent(GameObject instanceGameObject, Component assetComponent, InteractionMode action)
Parameters
ConnectGameObjectToPrefab(GameObject, GameObject)
Declaration
[Obsolete("Use RevertPrefabInstance. Prefabs instances can no longer be connected to Prefab Assets they are not an instance of to begin with.")]
public static GameObject ConnectGameObjectToPrefab(GameObject go, GameObject sourcePrefab)
Parameters
Returns
|
Improve this Doc
View Source
CreateEmptyPrefab(String)
Declaration
[Obsolete("The concept of creating a completely empty Prefab has been discontinued. You can however use SaveAsPrefabAsset with an empty GameObject.")]
public static Object CreateEmptyPrefab(string path)
Parameters
Type |
Name |
Description |
String |
path |
|
Returns
|
Improve this Doc
View Source
CreatePrefab(String, GameObject)
Declaration
[Obsolete("Use SaveAsPrefabAsset instead.")]
public static GameObject CreatePrefab(string path, GameObject go)
Parameters
Returns
|
Improve this Doc
View Source
CreatePrefab(String, GameObject, ReplacePrefabOptions)
Declaration
[Obsolete("Use SaveAsPrefabAsset or SaveAsPrefabAssetAndConnect instead.")]
public static GameObject CreatePrefab(string path, GameObject go, ReplacePrefabOptions options)
Parameters
Returns
DisconnectPrefabInstance(Object)
Declaration
[Obsolete("The concept of disconnecting Prefab instances has been deprecated.")]
public static void DisconnectPrefabInstance(Object targetObject)
Parameters
Type |
Name |
Description |
Object |
targetObject |
|
FindPrefabRoot(GameObject)
Declaration
[Obsolete("Use GetOutermostPrefabInstanceRoot if source is a Prefab instance or source.transform.root.gameObject if source is a Prefab Asset object.")]
public static GameObject FindPrefabRoot(GameObject source)
Parameters
Returns
FindRootGameObjectWithSameParentPrefab(GameObject)
Declaration
[Obsolete("FindRootGameObjectWithSameParentPrefab is deprecated, please use GetOutermostPrefabInstanceRoot instead.")]
public static GameObject FindRootGameObjectWithSameParentPrefab(GameObject target)
Parameters
Returns
FindValidUploadPrefabInstanceRoot(GameObject)
Declaration
[Obsolete("FindValidUploadPrefabInstanceRoot is deprecated, please use GetOutermostPrefabInstanceRoot instead.")]
public static GameObject FindValidUploadPrefabInstanceRoot(GameObject target)
Parameters
Returns
|
Improve this Doc
View Source
GetAddedComponents(GameObject)
Declaration
public static List<AddedComponent> GetAddedComponents(GameObject prefabInstance)
Parameters
Returns
|
Improve this Doc
View Source
GetAddedGameObjects(GameObject)
Declaration
public static List<AddedGameObject> GetAddedGameObjects(GameObject prefabInstance)
Parameters
Returns
|
Improve this Doc
View Source
GetCorrespondingObjectFromOriginalSource<TObject>(TObject)
Declaration
public static TObject GetCorrespondingObjectFromOriginalSource<TObject>(TObject componentOrGameObject)
where TObject : Object
Parameters
Type |
Name |
Description |
TObject |
componentOrGameObject |
|
Returns
Type Parameters
|
Improve this Doc
View Source
GetCorrespondingObjectFromSource<TObject>(TObject)
Declaration
public static TObject GetCorrespondingObjectFromSource<TObject>(TObject componentOrGameObject)
where TObject : Object
Parameters
Type |
Name |
Description |
TObject |
componentOrGameObject |
|
Returns
Type Parameters
|
Improve this Doc
View Source
GetCorrespondingObjectFromSourceAtPath<TObject>(TObject, String)
Declaration
public static TObject GetCorrespondingObjectFromSourceAtPath<TObject>(TObject componentOrGameObject, string assetPath)
where TObject : Object
Parameters
Type |
Name |
Description |
TObject |
componentOrGameObject |
|
String |
assetPath |
|
Returns
Type Parameters
|
Improve this Doc
View Source
GetIconForGameObject(GameObject)
Declaration
public static Texture2D GetIconForGameObject(GameObject gameObject)
Parameters
Returns
GetNearestPrefabInstanceRoot(Object)
Declaration
public static GameObject GetNearestPrefabInstanceRoot(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
|
Improve this Doc
View Source
GetObjectOverrides(GameObject, Boolean)
Declaration
public static List<ObjectOverride> GetObjectOverrides(GameObject prefabInstance, bool includeDefaultOverrides = false)
Parameters
Returns
GetOutermostPrefabInstanceRoot(Object)
Declaration
public static GameObject GetOutermostPrefabInstanceRoot(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
|
Improve this Doc
View Source
GetPrefabAssetPathOfNearestInstanceRoot(Object)
Declaration
public static string GetPrefabAssetPathOfNearestInstanceRoot(Object instanceComponentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
instanceComponentOrGameObject |
|
Returns
|
Improve this Doc
View Source
GetPrefabAssetType(Object)
Declaration
public static PrefabAssetType GetPrefabAssetType(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
GetPrefabInstanceHandle(Object)
Declaration
public static Object GetPrefabInstanceHandle(Object instanceComponentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
instanceComponentOrGameObject |
|
Returns
|
Improve this Doc
View Source
GetPrefabInstanceStatus(Object)
Declaration
public static PrefabInstanceStatus GetPrefabInstanceStatus(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
GetPrefabObject(Object)
Declaration
[Obsolete("Use GetPrefabInstanceHandle for Prefab instances. Handles for Prefab Assets has been discontinued.")]
public static Object GetPrefabObject(Object targetObject)
Parameters
Type |
Name |
Description |
Object |
targetObject |
|
Returns
|
Improve this Doc
View Source
GetPrefabParent(Object)
Declaration
[Obsolete("Use GetCorrespondingObjectFromSource.")]
public static Object GetPrefabParent(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
|
Improve this Doc
View Source
GetPrefabType(Object)
Declaration
[Obsolete("Use GetPrefabAssetType and GetPrefabInstanceStatus to get the full picture about Prefab types.")]
public static PrefabType GetPrefabType(Object target)
Parameters
Type |
Name |
Description |
Object |
target |
|
Returns
GetPropertyModifications(Object)
Declaration
public static PropertyModification[] GetPropertyModifications(Object targetPrefab)
Parameters
Type |
Name |
Description |
Object |
targetPrefab |
|
Returns
|
Improve this Doc
View Source
GetRemovedComponents(GameObject)
Declaration
public static List<RemovedComponent> GetRemovedComponents(GameObject prefabInstance)
Parameters
Returns
HasPrefabInstanceAnyOverrides(GameObject, Boolean)
Declaration
public static bool HasPrefabInstanceAnyOverrides(GameObject instanceRoot, bool includeDefaultOverrides)
Parameters
Returns
InstantiateAttachedAsset(Object)
Declaration
public static Object InstantiateAttachedAsset(Object targetObject)
Parameters
Type |
Name |
Description |
Object |
targetObject |
|
Returns
|
Improve this Doc
View Source
InstantiatePrefab(Object)
Declaration
public static Object InstantiatePrefab(Object assetComponentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
assetComponentOrGameObject |
|
Returns
|
Improve this Doc
View Source
InstantiatePrefab(Object, Scene)
Declaration
public static Object InstantiatePrefab(Object assetComponentOrGameObject, Scene destinationScene)
Parameters
Type |
Name |
Description |
Object |
assetComponentOrGameObject |
|
Scene |
destinationScene |
|
Returns
IsAddedComponentOverride(Object)
Declaration
public static bool IsAddedComponentOverride(Object component)
Parameters
Type |
Name |
Description |
Object |
component |
|
Returns
|
Improve this Doc
View Source
IsAddedGameObjectOverride(GameObject)
Declaration
public static bool IsAddedGameObjectOverride(GameObject gameObject)
Parameters
Returns
|
Improve this Doc
View Source
IsAnyPrefabInstanceRoot(GameObject)
Declaration
public static bool IsAnyPrefabInstanceRoot(GameObject gameObject)
Parameters
Returns
IsDefaultOverride(PropertyModification)
Declaration
public static bool IsDefaultOverride(PropertyModification modification)
Parameters
Returns
IsDisconnectedFromPrefabAsset(Object)
Declaration
public static bool IsDisconnectedFromPrefabAsset(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
|
Improve this Doc
View Source
IsOutermostPrefabInstanceRoot(GameObject)
Declaration
public static bool IsOutermostPrefabInstanceRoot(GameObject gameObject)
Parameters
Returns
IsPartOfAnyPrefab(Object)
Declaration
public static bool IsPartOfAnyPrefab(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
IsPartOfImmutablePrefab(Object)
Declaration
public static bool IsPartOfImmutablePrefab(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
IsPartOfModelPrefab(Object)
Declaration
public static bool IsPartOfModelPrefab(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
IsPartOfNonAssetPrefabInstance(Object)
Declaration
public static bool IsPartOfNonAssetPrefabInstance(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
IsPartOfPrefabAsset(Object)
Declaration
public static bool IsPartOfPrefabAsset(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
IsPartOfPrefabInstance(Object)
Declaration
public static bool IsPartOfPrefabInstance(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
|
Improve this Doc
View Source
IsPartOfPrefabThatCanBeAppliedTo(Object)
Declaration
public static bool IsPartOfPrefabThatCanBeAppliedTo(Object gameObjectOrComponent)
Parameters
Type |
Name |
Description |
Object |
gameObjectOrComponent |
|
Returns
IsPartOfRegularPrefab(Object)
Declaration
public static bool IsPartOfRegularPrefab(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
IsPartOfVariantPrefab(Object)
Declaration
public static bool IsPartOfVariantPrefab(Object componentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
componentOrGameObject |
|
Returns
IsPrefabAssetMissing(Object)
Declaration
public static bool IsPrefabAssetMissing(Object instanceComponentOrGameObject)
Parameters
Type |
Name |
Description |
Object |
instanceComponentOrGameObject |
|
Returns
|
Improve this Doc
View Source
LoadPrefabContents(String)
Declaration
public static GameObject LoadPrefabContents(string assetPath)
Parameters
Type |
Name |
Description |
String |
assetPath |
|
Returns
LoadPrefabContentsIntoPreviewScene(String, Scene)
Declaration
public static void LoadPrefabContentsIntoPreviewScene(string prefabPath, Scene scene)
Parameters
MergeAllPrefabInstances(Object)
Declaration
[Obsolete("MergeAllPrefabInstances is deprecated. Prefabs are merged automatically. There is no need to call this method.")]
public static void MergeAllPrefabInstances(Object targetObject)
Parameters
Type |
Name |
Description |
Object |
targetObject |
|
ReconnectToLastPrefab(GameObject)
Declaration
[Obsolete("Use RevertPrefabInstance.")]
public static bool ReconnectToLastPrefab(GameObject go)
Parameters
Returns
RecordPrefabInstancePropertyModifications(Object)
Declaration
public static void RecordPrefabInstancePropertyModifications(Object targetObject)
Parameters
Type |
Name |
Description |
Object |
targetObject |
|
|
Improve this Doc
View Source
ReplacePrefab(GameObject, Object)
Declaration
[Obsolete("Use SaveAsPrefabAsset with a path instead.")]
public static GameObject ReplacePrefab(GameObject go, Object targetPrefab)
Parameters
Returns
|
Improve this Doc
View Source
ReplacePrefab(GameObject, Object, ReplacePrefabOptions)
Declaration
[Obsolete("Use SaveAsPrefabAsset or SaveAsPrefabAssetAndConnect with a path instead.")]
public static GameObject ReplacePrefab(GameObject go, Object targetPrefab, ReplacePrefabOptions replaceOptions)
Parameters
Returns
ResetToPrefabState(Object)
Declaration
[Obsolete("Use RevertObjectOverride.")]
public static bool ResetToPrefabState(Object obj)
Parameters
Type |
Name |
Description |
Object |
obj |
|
Returns
|
Improve this Doc
View Source
RevertAddedComponent(Component, InteractionMode)
Declaration
public static void RevertAddedComponent(Component component, InteractionMode action)
Parameters
|
Improve this Doc
View Source
RevertAddedGameObject(GameObject, InteractionMode)
Declaration
public static void RevertAddedGameObject(GameObject gameObject, InteractionMode action)
Parameters
|
Improve this Doc
View Source
RevertObjectOverride(Object, InteractionMode)
Declaration
public static void RevertObjectOverride(Object instanceComponentOrGameObject, InteractionMode action)
Parameters
RevertPrefabInstance(GameObject)
Declaration
[Obsolete("Use the overload that takes an InteractionMode parameter.")]
public static bool RevertPrefabInstance(GameObject go)
Parameters
Returns
|
Improve this Doc
View Source
RevertPrefabInstance(GameObject, InteractionMode)
Declaration
public static void RevertPrefabInstance(GameObject instanceRoot, InteractionMode action)
Parameters
|
Improve this Doc
View Source
RevertPropertyOverride(SerializedProperty, InteractionMode)
Declaration
public static void RevertPropertyOverride(SerializedProperty instanceProperty, InteractionMode action)
Parameters
|
Improve this Doc
View Source
RevertRemovedComponent(GameObject, Component, InteractionMode)
Declaration
public static void RevertRemovedComponent(GameObject instanceGameObject, Component assetComponent, InteractionMode action)
Parameters
|
Improve this Doc
View Source
SaveAsPrefabAsset(GameObject, String)
Declaration
public static GameObject SaveAsPrefabAsset(GameObject instanceRoot, string assetPath)
Parameters
Returns
|
Improve this Doc
View Source
SaveAsPrefabAsset(GameObject, String, out Boolean)
Declaration
public static GameObject SaveAsPrefabAsset(GameObject instanceRoot, string assetPath, out bool success)
Parameters
Returns
|
Improve this Doc
View Source
SaveAsPrefabAssetAndConnect(GameObject, String, InteractionMode)
Declaration
public static GameObject SaveAsPrefabAssetAndConnect(GameObject instanceRoot, string assetPath, InteractionMode action)
Parameters
Returns
|
Improve this Doc
View Source
SaveAsPrefabAssetAndConnect(GameObject, String, InteractionMode, out Boolean)
Declaration
public static GameObject SaveAsPrefabAssetAndConnect(GameObject instanceRoot, string assetPath, InteractionMode action, out bool success)
Parameters
Returns
|
Improve this Doc
View Source
SavePrefabAsset(GameObject)
Declaration
public static GameObject SavePrefabAsset(GameObject asset)
Parameters
Returns
SetPropertyModifications(Object, PropertyModification[])
Declaration
public static void SetPropertyModifications(Object targetPrefab, PropertyModification[] modifications)
Parameters
|
Improve this Doc
View Source
UnloadPrefabContents(GameObject)
Declaration
public static void UnloadPrefabContents(GameObject contentsRoot)
Parameters
|
Improve this Doc
View Source
UnpackPrefabInstance(GameObject, PrefabUnpackMode, InteractionMode)
Declaration
public static void UnpackPrefabInstance(GameObject instanceRoot, PrefabUnpackMode unpackMode, InteractionMode action)
Parameters
UnpackPrefabInstanceAndReturnNewOutermostRoots(GameObject, PrefabUnpackMode)
Declaration
public static GameObject[] UnpackPrefabInstanceAndReturnNewOutermostRoots(GameObject instanceRoot, PrefabUnpackMode unpackMode)
Parameters
Returns
Extension Methods