Search Unity

working case for OnPostprocessGameObjectWithUserProperties

Discussion in 'Scripting' started by GabeF, Oct 27, 2014.

  1. GabeF

    GabeF

    Joined:
    Sep 28, 2012
    Posts:
    38
    Hi Guys,

    I know what I want but don't know how to get there.
    I would like to process a bunch of extra properties of my maya object on import so I'm trying to use the OnPostprocessGameObjectWithUserProperties. asset postprocessor.

    So what I'm trying to do is essentially create a list of textures that i can reference dynamically and switch between them when running the game.
    How do I do this? I have converted my model to a prefab with the postprocessmodel postprocessor. However, I first need to read the imported strings with the userproperties processor, and then search for the textures in my unity file paths, and if they exist, set a reference to it on a class on my prefab.

    Firstly, what is the best way to collect that info? I am just trying to first of all collect it, then put it on my prefab as a postprocess. But do I create a temporary class to hold the data in the meantime while the collection takes place, then add a script to my prefab and fill that with the appropriate variables? Then discard the temporary class? I really don't know what the most elegant solution is. I'm not a coder, but would like to make my code as clean as possible. What would you recommend for this process?
     
  2. GabeF

    GabeF

    Joined:
    Sep 28, 2012
    Posts:
    38
    BUMP
    Do I create a struct? I've heard something about structs to handle this but I've never used them.