Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I load FBX file in Unity runtime?

Tags:

c#

unity3d

fbx

I am on a hololens project. My boss says, load the fbx file at runtime (we use unity). Our fbx file changes at runtime, so we must reload it (fbx is change from 3dMAx).

I tried the AssetBundle, but I can't create Assetbundle files without unity or unity editor mode. As far as I know, only resource (in Project tab) can insert assets to assetbundle. If I can build Assetbundle file by fbx file without unity project, I can do all.

To sum it up: I need way how to load fbx in runtime without unity resource. If I make fbx asset to assetbundle in runtime (fbx is not belong in project tab), it's ok.


edit)

Using trilib asset is the best way. I try make own FBX loader, it's too difficult and a big job. I think trilib is not perfect, but it is the best.

like image 561
Redwings Avatar asked Dec 18 '22 21:12

Redwings


2 Answers

You could consider converting FBX into glTF, which Unity can load at runtime with UnityGLTF tools.

https://github.com/KhronosGroup/UnityGLTF

like image 120
perza Avatar answered Dec 30 '22 09:12

perza


You can read follow content:

is-there-an-easy-way-to-import-fbx-files-runtime:

In short: No.

Unity doesn't support importing / loading of any model format at runtime. The only exception are AssetBundles. Your options are basically:

  • Use AssetBundles

  • Find an importer for your desired format for Unity

  • Write such an importer yourself

  • Look for a feature request / write one yourself to ask UT if they add runtime model loading routines.

how-to-convert-3ds-fbx-model-into-asset-bundle-at-run-time:

Is there a tool which converts 3D models to asset bundles ? or is it possible to convert them at run time ?

You can't during the run-time because every Unity API to create Assetbundle is only available on the Editor for Editor plugins only.

I search many website for this question. Finally, I recommand that you could use this asset.It's is not free,but worth.It could save much time for you.

trilib-unity-model-loader

I hope this can help you.

like image 29
Ron Tang Avatar answered Dec 30 '22 09:12

Ron Tang