Whenever Unity imports a mesh, it will only recognize primitives which are connected to a face. Any floating vertices or edges will not be imported. For example, this .obj has no faces, so when it is imported into Unity, no Mesh object will be created for it:
o Plane
v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000
l 3 1
l 1 2
l 2 4
l 4 3
lineobj-importer is a custom parser to fix this problem. The parser detects when .lineobj files are imported via an experimental Unity feature available from version 2017.1 called Scripted Importers.
Before (in Blender):
After (in Unity):
-
Place LineobjImporter.cs anywhere in your Unity project.
-
Export model as
.objfrom Blender with these settings:The most important thing is to check
Triangulate Faces. The importer will not work if you don't triangulate the faces. Other settings likeInclude UVs,Write Materials, orWrite Normalscan be turned on, but this importer will ignore these settings. -
Rename the file extension from
.objto.lineobj -
When you open Unity, the model should automatically be imported. All Blender objects should have been flattened and merged into a single
Mesh.
- Blender: 2.78
- Unity: 2017.1
- Vertices
- Edges
- Faces
- Vertex Normals
- Vertex Colors
- Texture coordinates
- Free-form geometry (like NURBS)
- Negative indices
- Materials
- Smooth shading
- Groups
- Object Names
- The current implementation is good enough for my purposes. I might add Blender plugin that enables importing
.lineobjin order to speed up the development process, and I might add vertex normals, but beyond that, I don't foresee myself adding any more features to this for the time being. But if you would like to contribute, go ahead and submit a PR and add your name and github email tocontributors.txt. - Thanks to Tim R. for pointing me in the right direction.



