- Home /
Adding submeshes seems to multiply the vertex and triangle count in render stats?
I have built a mesh in code, and so far the stats window has been accurately reporting the triangle and vertex counts. But I just added code to split the mesh into 8 submeshes. (It's a tile based puzzle game, so I've made 8 tilemap textures which are identically laid out but each one is a different colour.)
It's all working as it should - however in the stats window, the vertex and triangle counts have multiplied by 8. I know I am not adding any more triangles or vertices in the code - I am creating exactly the same number of vertices, and the total number of triangles is distributed between the submeshes.
Is the stats window reporting incorrectly, or is this a peculiarity of using submeshes? (If the latter, I can't understand why anybody would use them!)
I have just run into this issue, whats going on? Anyone know?
@techmage I think that this is just a statistical error in the Game View. It is adding the vertex count for each submesh (but the triangle count is correct). If you exa$$anonymous$$e your mesh using the Inspector you should find that your vertex count is correct.
One common cause for additional multiplying of vertex/triangle count is when you are using a multi-pass shader.
But I do believe this particular issue to be a bug with Unity. For example, if you create a mesh using a modelling package, again incorrect stats are shown. I have already submitted a bug report for this (about a month ago). I will be sure to post back to here if and when I get a follow-up E-mail regarding my bug report.
@techmage On an additional note, the Unity documentation states that submeshes are simply stored as triangle lists. This reassures my assumption that the vertex buffer is still being shared between submeshes: http://docs.unity3d.com/Documentation/ScriptReference/$$anonymous$$esh.SetTriangles.html