karl- / pb_Stl

STL import/export for Unity, supporting both ASCII and Binary.
MIT License
179 stars 43 forks source link

Stl import at runtime #25

Open Narfath opened 2 years ago

Narfath commented 2 years ago

I have a question how should I execute the import script during runtime?

I give the path to the Importer.Import() method but nothing happens. Is there any other parameter that I should add to the method besides the path?

braneof commented 1 year ago

I haven't tried it, but this fork updated the importer, so maybe they fixed it: https://github.com/JohnGames/pb_Stl

Orinion commented 4 months ago

You also have to send the mesh to a meshfilter if you want to render it

    var mesh = Importer.Import(pathToFile)[0];
    var meshFilter = new GameObject().AddComponent<MeshRenderer>().GetComponent<MeshFilter>();
    meshFilter.sharedMesh = mesh;