- Home /
Question by
$$anonymous$$ · Jun 14, 2019 at 05:17 AM ·
meshperformance optimizationdynamic mesh
Is there a way to directly set the number of vertices and indices in a mesh
I have a mesh which contains more than 50K vertices which change every frame. The vertices are produced in native code and available to me through a plugin. Each frame the number of vertices can change.
I'm looking for a way to quickly update a mesh with the vertices data with the minimum number of copies and memory allocation.
The thing that seems to be missing in the Mesh class is an API to set the number of vertices and indices.
It seems like I can use GetNativeVertexBufferPtr to get a direct pointer to the vertice buffer where I can copy my vertices data, but how can I tell the engine how many vertices in this buffer are actual data, so that it will ignore the rest of the buffer?
Thanks
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612203120im_/https://answers.unity.com/themes/thub/images/avi.jpg)