- Home /
Procedurally generated mesh not Rendering all triangles
I followed a tutorial for a procedural mesh generator, and it works perfectly. However, when I increase the grid size to over 100, the mesh doesn't fully generate, instead, it stops part way through the generation.
When I select the meshes gameobject, it gives a bounding box of what the full size would be. Any ideas? Surely there isn't a limit. Is there?
I followed this tutorial: Procedural Mesh Tutorial
Answer by Hayden-S · Dec 07, 2018 at 01:08 PM
I inadvertently discovered that there is a mesh vertex limit of 65535 in unity. Here is a thread on the topic if anyone is interested.
Note that Unity now supports 32 bit index buffers. However you have to explicitly set the indexFormat to 32bit.
some$$anonymous$$esh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
Of course this should be done before you assign / set any mesh data. $$anonymous$$eep in $$anonymous$$d that a 32 bit index buffer takes up double the memory space for the same amount of data compared to the normal 16 bit buffer. Also keep in $$anonymous$$d that some older hardware (mainly mobile afaik) may not support 32bit index buffers.