PrefabUtility.GetNearestPrefabInstanceRoot

Cambiar al Manual
public static GameObject GetNearestPrefabInstanceRoot (Object componentOrGameObject);

Parámetros

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

Valor de retorno

GameObject The nearest Prefab instance root.

Descripción

Return the GameObject that is the root of the nearest Prefab instance the object is part of.

The method will search up the parents in the Transform hierarchy until it finds the root of any Prefab instance, regardless of whether that instance is an applied nested Prefab inside another Prefab, or not.

The method will return null if the given object is not part of a Prefab instance. This includes GameObjects or components that have been added and not applied to a Prefab instance.

In the editor, Prefab instance roots have Open and Select buttons, and in the acse of an outermost Prefab instance root, an Overrides dropdown.

See also GetOutermostPrefabInstanceRoot.