Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


IsPartOfPrefabInstance(Object)

Returns true if the given object is part of a Prefab instance.
Read time 1 minuteLast updated 12 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public static bool IsPartOfPrefabInstance(Object componentOrGameObject)

Parameters

componentOrGameObject

The object to check. Must be a component or GameObject.

Returns

Type

Description

boolTrue if the object is part of a Prefab instance.

Remarks

It also returns true if the given object is part of Prefab instance that is inside a Prefab Asset. In that case both PrefabUtility.IsPartOfPrefabAsset and PrefabUtility.IsPartOfPrefabInstance will return true.
If the given object is part of a Prefab instance where the asset is missing, it will still return true.
To know if a given object is part of a Prefab instance but not part of a Prefab Asset, use PrefabUtility.IsPartOfNonAssetPrefabInstance.