I’m trying to pool my meshes for a terrain system.
(each terrain chunk has different vertex and index count)
I set the vertex and index count to sufficiently large size to accommodate different chunk sizes using
Mesh.SetVertexBufferParams
and
Mesh.SetIndexBufferParams
Then after
mesh.SetVertexBufferData
and
mesh.SetIndexBufferData
I can just set the submesh data to render the currently used vertices and indices.
This way we never re-allocate memory (hopefully, but still a block box).
However!
Now I can’t use Physics.BakeMesh, as it reads the garbage vertices and indices beyond what is used by the submesh!
Is there a way to properly pool Meshes while taking into account BakeMesh’s liberal reading of the mesh data?
Or, is there any additional information beyond the documentation on how to optimize mesh pooling?
Thanks!