- Home /
"Mesh indices out of range" when using ObjExporter
Hey everyone,
I procedurally generate several meshes in my scene. I've been using the ObjExporter (the Editor version) from the wiki to export them. When I reimport the previously exported file, I get a warning in the console which says "Mesh indices of [...] are out of range" for some of the meshes. These meshes aren't displayed in the scene when I instantiate the prefab that Unity creates from the .obj file. However, they were displayed just fine in the scene after the procedural generation, so I guess that it has to be a problem with the export script.
The weird thing is, that this is only the case for a few of the meshes. Does anyone have any experience with the .obj file format and had a similar problem with the script and fixed it? Or is there another simple way to export meshes, which can later be imported into unity? (I would rather not use the MeshSerializer from the wiki, as you cannot use Unity's built in import functionality but you have to used a function provided in the script, if I understood correctly).
Thanks in advance!
EDIT: When I use this script for export, I have the same problem but with different meshes...
I guess that it has to do with the triangle winding, because the error doesn't occur if I duplicate and flip the mesh, so that planar meshes are visible from both sides and then do the export, I don't get any warnings on the import.
Unfortunately this doubles the file size. Does anyone have a clue what could be wrong with the ObjExporter script and debug it?!