Version: 2022.2
public void SetMainObject (Object obj);

参数

obj 要设置为主要对象的对象。此对象必须已经使用 AddObjectToAsset 方法添加。

描述

设置导入的主要对象。

Use this method to specify the main object in the asset file.

Note: Before invoking this method, the object that is passed as the argument must first be added with AddObjectToAsset. If this method is not called, then one of the objects added through AddObjectToAsset is arbitrarily promoted as the main object. If objects of type GameObject are added through AddObjectToAsset, then SetMainObject must refer to one of these objects. Passing a different type of object results in the selection being ignored and an arbitrary GameObjects is promoted as the main object.

Note: This method returns an error when used in an AssetPostprocessor because the Importer sets the main object later in the import process.

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