A VisualElement must not allocate more than 65535 vertices.

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.)

Thanks!

Rosco-y

Well, I hoped it would be rounded corners causing the problem, but I’m not sure:

I “un-rounded” them, and I’m still getting the same error:

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.

Rosco-y

Nope, same problem, and 729 * 4 is only 2,619 vertices (if cubes only have 4 vertices)

Must be the characters?

Rosco-y

You know that you can simply select a Mesh and see its vertex count in the Inspector? :wink:

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?

Thank You!

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.)

Thanks Again!

Rosco-y

Good call:

I rendered 8 blocks, and no more error messages.

9828561--1413330--4Cubes.png

Thanks!

Rosco-y

1 Like

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.

Rosco-y