Playmaker Forum
PlayMaker Feedback => Action Requests => Topic started by: 8bitbrainpower on December 12, 2021, 12:06:00 PM
-
Hello PlayMaker Heroes,
I'm requesting custom actions to be able to use (get/set) Custom Properties that were first assigned in Blender to a 3D object, then exported to Unity.
It seems this is done with OnPostprocessGameObjectWithUserProperties (https://docs.unity3d.com/ScriptReference/AssetPostprocessor.OnPostprocessGameObjectWithUserProperties.html). According to Unity documentation these can be of type string, Vector4, bool, Color, float, int.
In case it could help, here's (https://forum.unity.com/threads/how-to-import-user-defined-attributes-from-fbx-files.409877/) an exemple of someone that got it working for Maya software. And here (https://forum.unity.com/threads/retrieve-custom-properties-from-fbx-file-im-almost-there.1148537/), someone trying to get it work for Blender.
Thank you whoever is willing to get into it!
-
Hi.
Can you make a package with a scene and a 3D object that already has the component
Also include the scripts it needs from the project folder and the 3D object
-
Hello djaydino,
Yes, no problem. But I need some guidelines. I am a playmaker only user and never bothered with scripts.
To sum up, you need:
A package file with:
a. An exported 3D object that holds Custom Properties (Float, Int, String)
b. The "OnPostprocessGameObjectWithUserProperties" script attached to the 3D object
Is that correct ? If yes it's almost ready, I just need to figure out why Unity is telling me "The script class cannot be found" when I try to attach the script to the object.
-
Hi.
I think the "OnPostprocessGameObjectWithUserProperties" is not the one to attach.
from here its using the "UserDataHolder"
https://forum.unity.com/threads/how-to-import-user-defined-attributes-from-fbx-files.409877/
This can be accessed and maybe even when using Get/Set Properties
-
Hi! Right, thanks for the help!
So I just copied the two scripts from the link you gave me, put the first one under "Editor" folder, and the second bound to the 3D Object.
From here it's working, the Unity console is printing the custom properties once importing the object. (see screeshot in the link at the bottom of the page)
In Blender, I set 3 properties:
- Float_custom with a value of 2
- Int_custom with a value of 3
- String_custom with a value of "MyString" (without commas)
I've been trying to access them with Playmaker, but no success. I've been trying with the built-in "Get Property" action and also by dragging the "User Data Holder" script in Playmaker window.
Here's the package (https://u.pcloud.link/publink/show?code=kZvFgNXZWtRnhsRdneFSfgMdPX0yMLxN8bNy) file containing the 3D object + the scripts. (Just in case, I also put the 3D Model and the Blender file in the folder)
Hope I got it right. Tell me if you need anything else.