What is the correct way to set FBX user properties for import in Unity ?

I have written an FBX extension plugin for Maya that writes custom user property data to the FBX model node. I have also written an AssetPostprocessor script in Unity.

Although the custom FBX property is marked as a user prop, the AssetPostprocessor method “OnPostprocessGameObjectWithUserProperties” does not execute when the FBX file is imported into Unity. The properties are definitely in the FBX file. I have checked it.

Question : What is the correct way to programmatically set FBX user properties so that they will be picked up by Unity’s AssetPostprocessor ?

I have included some sample code below. Please let me know if you can help.
Maya Plugin Code Sample:

void WriteUserProp(FbxNode* pNode){
   FbxProperty myProp = FbxProperty::Create(pNode, FbxStringListDT, "MyCustomProp");
   myProp.ModifyFlag(FbxPropertyAttr::eUserDefined, true);
   myProp.AddEnumValue( "A,B,C" );
   myProp.AddEnumValue( "D,E,F" );
   myProp.AddEnumValue( "G,H,I" );
}

FBX File Data Sample:

Model: 973885280, "Model::cat:polySurface1", "Mesh" {
   Version: 232
   Properties70:{
                   <snip>
        	   P: "MyCustomProp", "stringlist", "", "U",0, "A,B,C~D,E,F~G,H,I" 
        	}
   Shading: T
   Culling: "CullingOff"
}

AssetPostprocessor Code Sample:

void OnPostprocessGameObjectWithUserProperties(GameObject go, string[] names, System.Object[] values)
	{
		Debug.Log (this.GetType().ToString() + "::" + MethodInfo.GetCurrentMethod().Name );

		//FBX Models Only
		if (assetPath.IndexOf (".fbx") == -1)
			return;

		Debug.Log ("GameObject: " + go.name);

		for (int i = 0; i < names.Length; i++)
		{
			string propertyName = names*;*

_ object propertyValue = values*;*_

* Debug.Log("Propname: " + propertyName + " value: " +propertyValue);*
* }*
* }*

I seem to have found the culprit.

I tried building the Fbx SDK sample “UserProperties” which creates a simple fbx scene (cube, pyramid), adds user properties, then exports it as an fbx file.

UserProperties Sample Code:

void CreateUserProperties(FbxNode *pNode) 
{
    // Now we create the user properties 
    FbxProperty p1 = FbxProperty::Create(pNode, FbxBoolDT, "MyBooleanProperty", "My Bool");
    FbxProperty p2 = FbxProperty::Create(pNode, FbxFloatDT, "MyRealProperty", "My floating point number");
    FbxProperty p3 = FbxProperty::Create(pNode, FbxColor3DT, "MyColorProperty", "My Color");
    FbxProperty p4 = FbxProperty::Create(pNode, FbxIntDT, "MyInteger", "");
    FbxProperty p5 = FbxProperty::Create(pNode, FbxDouble4DT, "MyVector", "");
    FbxProperty p6 = FbxProperty::Create(pNode, FbxStringListDT, "MyList", "");
/* 
NOTE: The properties labels exists only while the property object is in memory.
The label is not saved in the FBX file. When loading properties from the FBX file
it will take the same value as the property name.
*/

// we now fill the properties. All the properties are user properties so we set the
// correct flag
p1.ModifyFlag(FbxPropertyAttr::eUserDefined, true);
p2.ModifyFlag(FbxPropertyAttr::eUserDefined, true);
p3.ModifyFlag(FbxPropertyAttr::eUserDefined, true);
p4.ModifyFlag(FbxPropertyAttr::eUserDefined, true);
p5.ModifyFlag(FbxPropertyAttr::eUserDefined, true);
p6.ModifyFlag(FbxPropertyAttr::eUserDefined, true);

// let's make MyColorProperty, MyVector and MyList animatables
p3.ModifyFlag(FbxPropertyAttr::eAnimatable, true);
p5.ModifyFlag(FbxPropertyAttr::eAnimatable, true);
p6.ModifyFlag(FbxPropertyAttr::eAnimatable, true);

// we set the default values
FbxColor lRed(1.0, 0.0, 0.0);
p1.Set(false);
p2.Set(3.33);
p3.Set(lRed);
p4.Set(11);
p5.Set(FbxDouble3(-1.1, 2.2, -3.3));
p6.Set(2);

// and some limits
p4.SetLimits(-5.0, 9.0);
p5.SetLimits(0.0, 2.1);

// add elements to the list
p6.AddEnumValue("one");
p6.AddEnumValue("two");
p6.AddEnumValue("three");
p6.AddEnumValue("Four");
p6.InsertEnumValue(0, "zero");

}

When I imported the sample’s fbx file into Unity, every property in the sample that was set got logged in the ‘OnPostprocessGameObjectWithUserProperties’ method EXCEPT FOR ONE!.

The Fbx StringList property. It’s apparently not supported by Unity as a user property.

This was the property I was trying to use in my plugin. I will have to use a different property scheme.