- Home /
Is there an easy way to import fbx files runtime?
My project is to make a little car driving simulator where the player can import his own fbx models in and drive them in the game. I have not found an easy solution for this. Is there one? Or the only possibility is to write my own fbx importer.
There are assets in the asset store that could do this. But with that concept, it's better if you have a fbx template for the player to refer and they will just modify it to their liking to avoid scaling and rotation problems and other issues.
Answer by Bunny83 · Oct 12, 2017 at 11:20 AM
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.
The first solution is probably the easiest for you as developer, but not that easy for your endusers. If they want to provide their own models they would need to download Unity, import their model into an empty project and create an AssetBundle of the model. For this you could provide a special model importing project that they could use to correctly create and save the model as asset. This way they can actually fix wrong rotations or scaling of their model. You would just load a specific prefab from that bundle.
Finding an importer (on the assetstore or elsewhere) is mainly luck and a question of your budget. There are importers out there but most of them are not free as it's quite a bit of work to create such an importer. Of course there are very simple formats (like OBJ) where you find free importers on the net.
Writing an importer yourself depends on your skill and how well your target format is specified / documented. FBX for example has no official public documentation of it's format. Autodesk provides a C++ closed source SDK which can create and load FBX. It has some license requirements and you still need to get it working in your project. Though there has been done some work to reverse engineer the binary format.
The last option isn't really an option. I'm sure someone already asked for model loading support on the feedback page. A quick google revealed: this one and this one which funnily are both from the same user and have no upvotes from other people. Supporting any kind of model loading would require a lot of work from UT and it would blow up the engine. Things like the FBX SDK would cause licensing problems as enduser products have to mention that they use Autodesk software in their product. So it's very unlikely that such a feature would come any time soon. There are more general requests like this and this but as i said it's unlikely they will implement any of this. The Unity editor does only support a couple of 3d formats which you can find here (specifically: ".fbx, .dae (Collada), .3ds, .dxf, .obj, and .skp files"). Any other format actually requires the proper software installed to do an automatic export to fbx (such as blender for .blend files and 3dsMax for .max). Another quote from that page:
Note: Assets saved as .ma, .mb, .max, .c4d, or .blend files fail to import unless you have the corresponding DCC software installed in your computer. This means that everybody working on your Unity project must have the correct software installed. For example, if you use Maya to create ExampleModel.mb and copy it into your project, anyone else opening that project also needs to have Maya installed on their computer.
Answer by QubixGames · Jan 31, 2018 at 10:05 AM
Hi, we found library for that (called TriLib on asset store), it works perfect on standalone but unfortunately on iOS doesnt work yet - they have build for iOS, but we were successful only with simple box object. It is crashing inside of third party library used by trilib. TriLib developer is frequently working on his project, so maybe in near future will be everything ok
Your answer
Follow this Question
Related Questions
IMPORTING ASSET BLENDER FILE .FBX TO UNITY SO SLOW 2 Answers
ImportFBX error resulting in meshes missing 0 Answers
How to change a part of a model dynamically? 1 Answer
Convert fbx model to gameobjet 1 Answer
SketchUp to Unity Problems 10 Answers