How to add UserData to FBX

according to the docs you can add special meta-data in your 3D application when you export to FBX that can be used upon importing in unity.

i could not find a way to do so in 3Ds Max or Blender. does anybody know how to do it in their app of choice?

feel free to use this testscript:

using UnityEngine;
using UnityEditor;

public class ImportTester : AssetPostprocessor
{
    public void OnPreprocessModel()
    {
        ModelImporter modelImporter = (ModelImporter) assetImporter;		
		Debug.Log("userdata: "+modelImporter.userData);
    }   
}

save it as “ImportTester.cs” in a Folder called “Editor” within the “Assets” folder.

You can set the userData in your script; you wont get any userData from it unless you’ve previously set it on a prior import.

var modelimp = this.assetImporter as ModelImporter;
modelimp.userData = "hello world";

If you look at the .meta file as text for your asset you’ll see that the userData field now reads “hello world”. You’ll need to set your project to use meta files in text to see it but it should work for other settings.

In Maya you can assign user attributes to any node that gets exported into FBX. FBX will probably also have ability to retain custom data from MAX and Blender. Then when you are trying it read this data during Unity Import it can be done with function AssetPostprocessor.OnPostprocessGameObjectWithUserProperties

It will require some jumping through hoops to get all working as you wish and this function runs after materials and few other things already created, but you can still do a lot with your custom data here.

yury

For 3Ds Max you can select your object.
Right click and then select Object Properties.
On the tabs at the top, select “User Defined”.
You can add the text you want in this part.