Import OBJ Via Code (Natively)

Hi All,

I am searching through the scripting help but I can’t seem to find the function that will import an OBJ file, on-the-fly while the game is running. I assume this is possible, natively, without some external asset.

Does anyone have a link to show some code on how to accomplish this task?

Thanks

It isn’t. The actual model importing is being handled by the editor. You’ll need an asset to do it at runtime. Try this.

http://wiki.unity3d.com/index.php?title=ObjImporter

Thanks for the link to the code.

Do you happen to know if that posted code can import OBJ files that contain quads or ngons?

Is it assumed that when using Unity you have to pre-convert any OBJ files into a triangles only mesh in your host 3D application before export?

A quick glance at the source seems to suggest its made for triangles only.

I don’t know. I haven’t used OBJ in years. Best I can suggest is to experiment.