⚠ Preview docs — built from the develop branch and may be unstable. Go to the stable docs.

Mesh.FromFile

static Mesh FromFile(string file, int loadPriority)

Loads a single Mesh from a .stl, .ply (ASCII), or .svg file. These are formats that hold one mesh and no materials, so unlike Model there’s no scene to unpack. Anything richer, like .obj or .gltf, needs to come in through Model.FromFile. Loading happens asynchronously, so the Mesh returns right away and draws nothing until it finishes. Check AssetState or OnLoaded if you need to know when, and note that Bounds stays empty until then.

SVG files become flat, vertex colored geometry, see the “Working with 3D Assets” guide for what’s supported and how they’re sized.

   
string file A mesh file, an absolute filename, or a filename relative to the assets folder.
int loadPriority The priority sort order for this asset in the async loading system. Lower values mean loading sooner.
RETURNS: Mesh A Mesh asset, or null if the file type is unrecognized! A file that exists but fails to load returns a Mesh in an error AssetState instead.




Found an issue with these docs, or have some additional questions? Create an Issue on Github!