How to load a mesh file at runtime

I would like to know if it’s possible to load an asset not known at coding time with Unity (could not be in a ressource directory). I’m new to Unity and couldn’t found the answer on the web.

For example my program should have an editable zone and a button, the user will enter a mesh file path (dae file for example) and click the button. The program will clear the scene (not the light and camera), load the mesh, scale the mesh and move the camera to show the new mesh.

I found example of code building a mesh by calculation, but not just loading a “standard” file. Is there an example somewhere?

I use the new version 5.0.0p1

There's an .Obj importer on the wiki:

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

But I believe Eric has a fuller featured version that you can purchase:

http://www.starscenesoftware.com/objreader.html

1 Like

Thanks,

I also found, since my post, https://github.com/EdyJ/blender-to-unity3d-importer
It’s a way to achive my goal, but not the one I thougth would be available in Unity. I’m a little bit disappointed.

Some importers here (couple of them have free trial/demo packages available)
https://www.assetstore.unity3d.com/en/#!/search/model%20import