Currently i am using the package to download zip file which contains 3d models in obj format. The download has been completed and converted to byte[], but I am not finding any way to convert the byte array to gameobject. Some solutions suggested writing the byte in a file but the problem is i am using webgl platform where IO is not allowed. Then how to convert byte to gameobject in webgl

  • 2
    \$\begingroup\$ But an obj is not a gameobject. Do you need to load the model in your gameobject? \$\endgroup\$
    – Zibelas
    Aug 31 '21 at 13:04
  • \$\begingroup\$ @Zibelas yes i mean the same to load the model \$\endgroup\$ Sep 1 '21 at 4:28
  • \$\begingroup\$ Do the people who provide those .obj files for download have access to the Unity game engine? \$\endgroup\$
    – Philipp
    Oct 1 '21 at 8:44

The problem is that an exported Unity project does not include the code necessary for importing models in 3rd party file formats like OBJ into the internal asset format of the game engine. That means importing raw .obj files at runtime would require your own implementation for parsing the file format (here is the specification) and turning it into a Mesh object. It's not actually that complicated compared to other 3d file formats out there, but would still be quite a lot of work, depending on how much of the format you need to support.

However, it would be much easier if you packed those 3d models into Asset Bundles using the Unity engine. An asset bundle is a packed archive of already imported and game-ready Unity assets. These assets can be just the models, or even complete prefabs with multiple components including MeshFilters which reference those models.

You can then download those asset bundles at runtime with the method UnityWebRequestAssetBundle.GetAssetBundle(url). You can then extract the assets from that asset bundle via the methods of the AssetBundle class or via Addressables.


You might want to consider Asset bundles. The idea is to first create the gameobject in game then export it in a format which unity is able to load at runtime.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .