Version: 2021.2

PrefabUtility.LoadPrefabContentsIntoPreviewScene

切换到手册
public static void LoadPrefabContentsIntoPreviewScene (string prefabPath, SceneManagement.Scene scene);

参数

scene 将内容加载到其中的场景。
prefabPath 要加载其内容的预制件资源的路径。

描述

将给定路径上的预制件资源加载到给定预览场景中,并返回预制件的根游戏对象。

可以使用它来获取预制件的内容并直接予以修改,而不是遍历预制件的实例。这可用于批处理操作。

Once you have modified the Prefab you have to write it back using SaveAsPrefabAsset. After that you can either reuse your preview scene for other purposes, or close the preview scene with EditorSceneManager.CloseScene.

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