Version: 2022.3
언어: 한국어

PrefabUtility.UnpackPrefabInstance

매뉴얼로 전환
public static void UnpackPrefabInstance (GameObject instanceRoot, PrefabUnpackMode unpackMode, InteractionMode action);

파라미터

instanceRoot The root of the Prefab instance to unpack.
unpackMode Whether to unpack the outermost root or unpack completely.
action The interaction mode to use for this action.

설명

Unpacks a given Prefab instance so that it is replaced with the contents of the Prefab Asset while retaining all override values.

The given object must be the root of a Prefab instance.

The contents of a Prefab Asset is the objects you see when you open it in Prefab Mode. Unpacking with a PrefabUnpackMode of OutermostRoot will replace the Prefab instance with that content. Unpacking with a PrefabUnpackMode of Completely will furthermore also unpack any Prefab instances that are part of the unpacked content, so that the end result is nothing but regular GameObjects and no Prefab instances.

The contents of a regular Prefab or a Model Prefab always has a regular GameObject at the root, so unpacking one of those will leave a regular GameObject at the root where the Prefab instance was before.

The contents of a Prefab Variant has an instance of the base Prefab at the root, so unpacking a Prefab Variant with a PrefabUnpackMode of OutermostRoot will leave an instance of the base Prefab where the Prefab Variant instance was before.

Unpacking throws an ArgumentException if the given object is not the root of a Prefab instance, or if it’s part of a Prefab Asset. This does not include Prefab contents opened in Prefab Mode.

InteractionMode determines if the action should be undoable.

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