Version: 2023.1

ModelImporter.extraUserProperties

切换到手册
public string[] extraUserProperties ;

描述

A list of default FBX properties to treat as user properties during OnPostprocessGameObjectWithUserProperties.

Specify the names of default FBX properties to be consider as extra user properties to pass to AssetPostprocessor.OnPostprocessGameObjectWithUserProperties.

using UnityEditor;
using UnityEngine;

public class MyPostProcessor : AssetPostprocessor { public override uint GetVersion() => 1;

//Adding 1 FBX default properties to be considered as UserProperties + 1 not existing in the imported FBX private void OnPreprocessModel() { string[] extraUserPropertyNames = { "currentUVSet", "MyNonFbxDefaultProperty" }; ((ModelImporter)assetImporter).extraUserProperties = extraUserPropertyNames; }

//Importing a FBX with a user defined Property "MyDefinedProperty" private void OnPostprocessGameObjectWithUserProperties(GameObject go, string[] propNames, object[] values) { foreach (var propName in propNames) { Debug.Log(propName); } }

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