- Home /
Use UserData from FBX to initialize member variables of a script
Hey, I'm actually trying to import UserData from FBX files to use them as initial values for a script.
By extending the AssetPostprocessor class it was easy to get the names and values of all UserData inside the import pipeline. For each game object with UserData assigned, I have added an instance of the same script as component, which should store the imported data. After that I have assigned the imported data to the member variables of the corresponding script instance.
As long as I'm inside the scope of the AssetPostprocessor class, the values of the member variables are set correctly. But if I'm trying to create an instance of the imported objects to use them in a scene, all member variables will be reset to their default value ("" for string, 0 for int, etc.).
Is there any possibility to transfer UserData from FBX files to Unity scripts, so I can use them during runtime?
Thank you in advance.
Regards Max