Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


HasPrefabInstanceAnyOverrides(GameObject, bool)

Returns true if the given Prefab instance has any overrides.
Read time 1 minuteLast updated 13 days ago

Definition

  • Type: Method
  • Namespace: UnityEditor
  • Assembly: UnityEditor
public static bool HasPrefabInstanceAnyOverrides(GameObject instanceRoot, bool includeDefaultOverrides)

Parameters

instanceRoot

The root GameObject of the Prefab instance to check.

includeDefaultOverrides

Set to true to consider default overrides as overrides too.

Returns

Type

Description

boolReturns true if there are any overrides.

Remarks

This method is the quickest way to check if a Prefab instance has any overrides, when not needing to know what those overrides are.
The includeDefaultOverrides parameter should normally be set to false, except for debugging purposes. If set to true, the method will normally return true for all Prefabs instances, since all Prefab instances have default overrides for the root position and rotation, among others.