My game has 729 prefabs, each with numbers 1-9 (TextMeshPro) on a canvas. This amounts to 6,561 TextMeshPro characters in my game for those numbers alone:
Could the number of TextMeshPro characters in my game be causing me to run into the 65535 vertice limit in Unity, or is it more likely that my 729 prefabs (cubes) have rounded edges–which would undoubtedly require a lot of triangles? (I hope it’s the latter–I can simplify my prefab’s edges easy enough–getting rid of the numbers would be a game-changer (pardon the pun.)
But I’m still not sure: visually counting I see 3 vertices at each corner, so 24 per cube x 729 = 17,496, well over the 65535 limit. I’ll try squaring the cubes right up, and see what happens.
You know that you can simply select a Mesh and see its vertex count in the Inspector?
The message also indicates “a VirtualElement must not” so it’s something with the element, not your mesh.
Given your screenshot I wonder if your layout consists of 9x9x9 = 729 VisualElements? Perhaps that is too many, try rendering only one of the nine main blocks to see if the error goes away.
The 9+ layers at depth hopefully aren’t active VisualElements too?
I didn’t know you can select a mesh and see its vertex count in the inspector. I will try rendering my game with fewer prefab to see what happens.
I’m fairly sure all of my prefabs are at least partially active, as I didn’t see any need to deactivate them when I instantiated them. Do you think it would help if I deactivated the ones not in use? (although they give a necessary clue that there are layers in the puzzle.)
So, I made a branch in my github repo so I could render only 8 cubes, and then easily return to “normal”.
The complaint that “A VisualElement must not allocate more than 65535 vertices” disappeared, so I went back to my original branch, and with no changes to my game that I’m aware of, the original error message has gone away (for the moment.)
Times like these make me wonder if I’m in over my head.