Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Read custom properties from .fbx

Discussion in 'Asset Importing & Exporting' started by Thibault_potier, Jul 28, 2021.

  1. Thibault_potier

    Thibault_potier

    Joined:
    May 4, 2021
    Posts:
    46
    Hi

    I want to be able to import an fbx file and read the custom properties of each nodes in the model

    Ultimately I want to do this at runtime, but right now I'm just trying to import manually the fbx into unity (this is done) and I want to be able to list all the custom properties on a script.

    I made a quick script to list all the nodes of the model, but how to access their custom properties ?

    Code (CSharp):
    1. public GameObject model;
    2.  
    3.     // Start is called before the first frame update
    4.     void Start()
    5.     {
    6.         PrintChildren(model.transform);
    7.     }
    8.     void PrintChildren(Transform t)
    9.     {
    10.         int child_count = t.childCount;
    11.         Debug.Log(t.name);
    12.  
    13.         for (int i = 0; i < child_count; ++i)
    14.         {
    15.             var child = t.GetChild(i);
    16.             PrintChildren(child);
    17.         }
    18.     }
    Any help appreciated :)
     
  2. erispe10

    erispe10

    Joined:
    May 16, 2022
    Posts:
    8
    Very interested in this also!