- Home /
Read .FBX file from C#
Hello!
I've been wondering for a while how I would go about creating a mesh variable from a file, preferably of the FBX file type. Is there a class that Unity3D has that I just don't know about that may let me do this, or will I have to script my own using a file line reader or something similar to that?
Thanks in advance for all replies.
-PhantomKnight.
And as another note, I'd like to be able to load files outside of the Assets folder. Otherwise my goal would be quite pointless.
Theres an Asset Store asset to read OBJ files (ObjReader by @Eric5h5), I think you'd have to write your own FBX reader.
Thanks, I may get that. So if that's the only one out there, I guess there's nothing free and no default Unity3D class function for it.
There is no default function and I know of nothing for free (though that's not saying I've looked).
you might be able to use Blender to import the fbx and export it in a unity friendly format.
Answer by whydoidoit · Dec 27, 2012 at 10:27 PM
There is no format that can be loaded at runtime. Loading models without a 3rd party package (like ObjReader) requires Pro and the construction of Asset Bundles.
Well every file can be read through text (although some may look like total jibberish, .obj has the cleanest text as I just noticed) and it is easily possible to load and read/create text files with C# in Unity. So with that, I guess it could take a bit of coding work to get a much simpler .obj reader which is really all I'll need. And if I get it done, I'll probably upload it elsewhere.
Well your question was if unity provides any classes to import models at runtime and the answer is: no except asset bundles which requires a unity pro license.
Of course you can use a third party library or write your own if you like / be able to.
If you want to share your work, there's a scripts section in the unity wiki. Feel free to post a link here when you created a loader ;)
Ah, okay. Sorry, didn't specify enough that I wasn't only asking for a Unity function. Thanks for the responses though, everyone!
Your answer

Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Need 3d Model for kinect 0 Answers
Why my imported fbx show semi transparent? 0 Answers
Extract Materials from fbx via script 3 Answers