Version: 2022.3
言語: 日本語

PrefabUtility.GetNearestPrefabInstanceRoot

マニュアルに切り替える
public static GameObject GetNearestPrefabInstanceRoot (Object componentOrGameObject);

パラメーター

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

戻り値

GameObject The nearest Prefab instance root.

説明

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

The method searches 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 returns 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.


Overview of which objects are Prefab instance roots.

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

See Also: GetOutermostPrefabInstanceRoot.