Search Unity

Question Import new prefab into published game

Discussion in 'Asset Importing & Exporting' started by dtootill, Jan 6, 2023.

  1. dtootill

    dtootill

    Joined:
    Oct 9, 2020
    Posts:
    29
    Is there any way to import a new prefab into a published game? I'm building a level editor for my game, and one feature I'd like would be for the player to create a new model (for example, an fbx file exported from Blender) and then use it in their game. In order to instantiate an object from the player's new model, I need a prefab containing it. This is easy to do with an editor script, but the player has only the published game. It's straightforward to import the fbx file into the game. Is there any way to create a prefab from it once it's imported? Or even put it into an existing prefab?
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    You don't need a prefab. You can use new GameObject() and add the stuff you need.
    You gotta manually import the models etc at runtime and add the appropriate components for it to work
     
  3. dtootill

    dtootill

    Joined:
    Oct 9, 2020
    Posts:
    29
    Thanks! I was stuck on prefabs, but your answer got me to rethink my question as "how do I create a GameObject from a byte array?". A little research found the free Unity asset ObjImporter that solved my problem
     
    DevDunk likes this.