PrefabUtility.GetOutermostPrefabInstanceRoot

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

Parámetros

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

Valor de retorno

GameObject The outermost Prefab instance root.

Descripción

Returns the GameObject that is the root of the outermost Prefab instance the object is part of.

The method will search up the parents in the Transform hierarchy until it finds the root of a Prefab instance which is not an applied nested Prefab inside another Prefab.

If the method finds a Prefab instance root which is an added GameObject to another Prefab instance, it will return that root, since it it not an applied nested Prefab root.

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.


Overview of which objects are Prefab instance roots.

In the editor, outermost Prefab instance roots have the Overrides dropdown, whereas other Prefab instance roots don’t.

See Also: GetNearestPrefabInstanceRoot.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961