Unity, Resources Folder and STL Files

On a recent project, I needed to load an STL file into a project in order to view the mesh within Unity. However, I came across a restraint with Unity, which is its inability to load STL files. However, I eventually discovered an STL import/export plugin on GitHub that enabled me to do this.

Before locating the plugin, I ran a code such as the following, which failed to load the STL file gameobject from the Resources folder.

GameObject stlGob = Resources.Load<GameObject>(stlFile); 
GameObject gameObject = Instantiate(stlGob, Vector3.zero, Quaternion.identity);

However, after installing the STL plugin, using the git approach, I was able to load the STL files. So in case you encounter this challenge, make sure the check out the plugin at this URL (at the time of writing of course).

STL import/export plugin - https://github.com/karl-/pb_Stl 

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: