1. Before you ask anything, make sure that you've read the FAQ

Loading external files

Discussion in 'Modding Suggestions' started by TimberWolf224, Aug 1, 2017.

  1. TimberWolf224

    TimberWolf224 Veteran Member

    Joined:
    Oct 16, 2015
    Messages:
    113
    Likes Received:
    35
    How would one go about adding an external model from within a folder at runtime, and associating it with a gameObject in game?

    As an example, say I want to create a ball of some type, with a specific model. I can create the gameObject and physics controller with a mod, but how do I attach the 'ball.obj' (or 'ball.dae', because .obj requires external textures, but .dae doesn't) to the GameObject without recompiling the assets files, and then get the mesh collider to work?

    If that is confusing, I'll put it this way: I have a gameObject, called ball. I want to get Unity to apply the model "Desktop\zerahypt_files\21.1\Zerahypt_Data\Mods\ball.obj" to the object, and to use that mesh for a mesh collider (so the collisions are correct). How do I do that? Could similar code to Initializer.ini be used to load external files other than .dll?

    If it helps, I'm running version 21.1 of zerahypt. (Not that there's anything wrong with the updates, I just have all my modding stuff on this version, and its the one I'm comfortable with. Update 29 is pretty badass though, I must say.)
    This issue has been giving me trouble for quite a long time, and any help is appreciated.
     
    Last edited: Aug 1, 2017