Jump to content
  • Advertisement
Sign in to follow this  
Videep

Unity Import FBX at Runtime in UNITY.

This topic is 1524 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Everyone,

 

I have been trying to research on loading FBX dynamically in unity. On various forums, I have found that one can just not load resources dynamically from a path on a drive at runtime. The solution to this till now is to read the FBX and create mesh and then do the material mapping etc.

 

I have to load upto 7GB of data into unity. If I call the data into editor, it crashes. What is the best way to do so?

 

Hope to receive a reply soon.

 

Thanks in advance.

Videep

Share this post


Link to post
Share on other sites
Advertisement

If the data is in your resources folder for unity you should be able to load it programatically as a normal resource load, even if it's not added to your scene.

Here's some code I use for loading fbx entities at runtime for weapons and the like. Having said that. loading 7GB of data at runtime isn't going to be much fun....

 public void LoadAndAttachModel(String boneName, String modelName)
    {
        Transform boneTransform = GladiusGlobals.FindChild(boneName, gameObject.transform);
        if (boneTransform != null)
        {
            GameObject load = Instantiate(Resources.Load(GladiusGlobals.ModelsRoot + modelName)) as GameObject;
            if (load != null)
            {
                load.transform.parent = boneTransform;
                load.transform.localPosition = Vector3.zero;
                load.transform.localRotation = Quaternion.Euler(new Vector3(90, 90, 0));
                load.transform.localScale = new Vector3(100f, 100f, 100f);
            }
        }
        else
        {
            Debug.LogWarning("Can't find boneName : " + boneName);
        }
    }

Share this post


Link to post
Share on other sites


I have been trying to research on loading FBX dynamically in unity.

FBX is generally not a good runtime format, and one of the major reasons is the size of assets encoded in FBX.

 

Unity has a built-in mechanism for this, in the form of Asset Bundles. Unfortunately, these are only available to users with a Pro license.

 

If you don't have a Pro license, you might want to look at the community-provided MeshSerializer script.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!