- Home /
OnPostprocessGameObjectWithUserProperties - user properties template?
EDIT: So I tried using Maya and exported an object with user properties assigned, and it worked fine! All the properties were read correctly when using Maya. Why doesn't it work when using 3dsmax? I can't use Maya, so I'm stuck with Max and I need to get it working :)
I use 3dsmax for all my modeling, and export to FBX format. I'm trying to read the user properties I assign to my objects in max with OnPostprocessGameObjectWithUserProperties, but not matter how many I had it always returns only 2:
Propname: UDP3DSMAX value: ObjAddOn = true
ObjSlider = 5
Propname: MaxHandle value: 426
My user properties on my model in 3dsmax look like this:
ObjAddOn = true
ObjSlider = 5
As you can see, I have 2 properties, but the script returns both of them as 1 (Propname: UDP3DSMAX value: ObjAddOn = true ObjSlider = 5) and then returns a second property that doesn't even exist (Propname: MaxHandle value: 426)
Is there a specific template to use when assigning properties to objects?
I am really lost on this one, there isn't any documentation on what properties should look like in your 3d program, and I can't find an answer anywhere!
Thanks in advance for any help, I would really appreciate it :) Stephane
Answer by ronronmx · Feb 21, 2012 at 11:04 PM
After banging my head against the wall for days, trying to get "User Defined Properties" to work with "OnPostprocessGameObjectWithUserProperties" when exporting objects from 3ds max...I finally figured it out.
The first thing you need to know, contrary to what "OnPostprocessGameObjectWithUserProperties" leads you to believe, is that it doesn't work with actual "User Defined Properties" that you assign to an object in 3ds max by right-clicking on the object, choosing "Object Properties", and adding text in the "User Defined Properties" tab. No sir, that's not what it's looking for!
Here's how to do it, using the "Parameter Editor" under the "Animation" menu:
With your object selected, in the menu bar, choose "Animation/Parameter Editor".
The Parameter Editor window will come up.
You can choose where to add the attribute, i suggest leaving it on "Selected Object's Base Level".
Select the type of parameter you want to add - float, int, bool...
Give the parameter a name.
Click the Add button.
If you left the attribute location to "Selected Object's Base Level", you'll find it in the Modify panel of your selected object, all the way at the bottom after all other tabs. You can then update the attribute there, for example if it's a bool, make it true or false, if it's an int, change its number etc...
That's it, export your object, and "OnPostprocessGameObjectWithUserProperties" will find the attributes just fine! If you have any questions, or if something doesn't make sense, feel free to ask and I'll help the best i can.
Stephane
Stephane, Thanks for sharing this insight. Is there any way to know the TYPE of the attribute, though?
Here's how I am getting it:
System.Object val = propValues[i]; // propValues is an array of System.Object
if( val.GetType( ) == typeof( bool ) ){...}
Your answer
![](https://koobas.hobune.stream/wayback/20220613064242im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to create 3d models for game and how to add them to game 2 Answers
AssetPostprocessor in 2018.3 0 Answers
MMD How to export model and animations to Unity as 3rd person controller? 2 Answers
imported 3D models don't batch. 0 Answers