在 OnPostprocessGameObjectWithUserProperties 期间将默认 FBX 属性视为用户属性的列表。
指定默认 FBX 属性的名称,这些属性将被视为额外的用户属性,以传递给 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 }