Retrieve custom properties from .fbx file - I'm almost there

Hi

I want to be able to read custom properties that 3d artist have put on fbx nodes. My purpose is to implement custom behaviour by reading those values. So far I’m able to access them when unity import the .fbx file by using OnPostprocessGameObjectWithUserProperties

void OnPostprocessGameObjectWithUserProperties(
        GameObject go,
        string[] propNames,
        System.Object[] values)
    {

        Debug.Log(go.name +" -----------------------------------------------");

        for (int i = 0; i < propNames.Length; i++)
        {
            string propName = propNames[i];
            System.Object value = (System.Object)values[i];

            Debug.Log("Propname: " + propName + " value: " + values[i]);
        }
    }

But it seems that I have a problem when reading some of the values :confused:

properties shown in blender :

properties retrieved with the above code :

As you can see, property “type” has now value “0” instead of “rotation”; and property “axis” is now “2” instead of “X”.

The weird thing is that property “nameAtt” has kept its string value “wheel”, so I really don’t know what to conclude here.

Does anyone have explanations, tips, or solutions to be able to retrieve properly those custom attributes? :stuck_out_tongue:

Perhaps words like “type”, “rotation” and “axis” are on some sort of undocumented reserved list. Try changing their names and values as an experiment to other things like “myType”, “myRotation” and “myAxis” or something along those lines and see if they show up that way.

Hey there! How is it going, any news on that subject ? I find this is a quite important feature, hope you sorted it out and willing to enlight us :wink:

So I don’t remember exactly, but the solution was to modified the source .fbx .

Probably use strings instead of enums in the nodes users properties. But it may also be some change in the export option, when exporting the .fbx with 3ds max.

In both case, the change was made on the model source in 3dsmax and not when importing it in unity

1 Like