playMaker

Author Topic: Accessing Custom Property of an FBX file, exported from Blender  (Read 1794 times)

8bitbrainpower

  • Playmaker Newbie
  • *
  • Posts: 14
Accessing Custom Property of an FBX file, exported from Blender
« 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. According to Unity documentation these can be of type string, Vector4, bool, Color, float, int.

In case it could help, here's an exemple of someone that got it working for Maya software. And here, someone trying to get it work for Blender.

Thank you whoever is willing to get into it!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Accessing Custom Property of an FBX file, exported from Blender
« Reply #1 on: December 13, 2021, 10:47:42 AM »
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

8bitbrainpower

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Accessing Custom Property of an FBX file, exported from Blender
« Reply #2 on: December 13, 2021, 02:19:52 PM »
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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Accessing Custom Property of an FBX file, exported from Blender
« Reply #3 on: December 13, 2021, 08:21:30 PM »
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

8bitbrainpower

  • Playmaker Newbie
  • *
  • Posts: 14
Re: Accessing Custom Property of an FBX file, exported from Blender
« Reply #4 on: December 13, 2021, 11:46:23 PM »
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 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.