Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

How to load a GameObject from Byte[] in the scene on runtime?

Hi all,

I apologize for being a novice and for asking an obvious question.

I am downloading a 3D object from URL. I am using UnityWebRequest to do so. The thing is the downloaded object is in the form of System.Byte[] but I want it to be GameObject and I cannot do that on the fly, can't even cast it.

This object is an .OBJ file of 22MB.

Basically I need a a piece of code that loads an object at runtime.

Thank you, Arjun

Answers

  • hi Arjun,

    I was looking for a similar thing for my project. If you're still looking for an answer, you can search the Unity Store for an application called Runtime OBJ Importer. It can be used to import obj files at runtime or in the Unity Editor provided the file exists on your PC/Desktop.

    Pranav

  • Hey Thanks Pranav,

    I got through that hurdle, but I got a new one. The model that I am importing has 1.4m vertices, more than 64 k vertices (which is max unity can support).

    Do you know anything about how to handle that??

    Arjun Chiddarwar

  • Hi Arjun,

    I have never handled so many mesh vertices before. For my project, if the CAD model had so many vertices, I used to open the object in a CAD software and reduce the number of nodes by increasing the mesh size and then re-exporting it to unity. Once I started doing that I could control the number of vertices in Unity by manipulating the mesh size in the CAD software. This solution suits my situation. If your object is a CAD part too, you can probably do the same. If not then sorry, I have no idea.

    If it isnt a CAD part and you figure out the answer, do post the solution here since it might help my project

    Hope this helps
    Pranav

  • Hi Arjun,

    I dont know if this would work. This doesn't sound good but one thing you can probably do is access all those objects programmatically and instead of rendering each and every mesh, just render alternate meshes or 1 in every 3 meshes or a smaller frequency than that depending upon the speed you want to achieve. I haven't checked the result of such a code and I dont think the quality of the render would be great. But, this can be a solution if you don't find any other one

    Pranav

Sign In or Register to comment.