So I have a procedural mesh that I want to dynamically add vertices too every frame.
In Javascript I used Arrays to store my vertices/tris/normal/uvs.
Then in the update function I would rebuild my mesh every time (so clearing all those arrays) and then adding the new vertices to the mesh using Array.Add.
Now in C# there is no Array variable so I’m doing this.
List<Vector3> vertices = new List<Vector3>();
List<Vector3> normals = new List<Vector3>();
List<Vector2> uv = new List<Vector2>();
List<int> triangles = new List<int>();
And then I’m adding vertices using List.Add.
I’ve noticed that these lists are much much slower than what I was used to in Javascript using Arrays, so I was wondering if I could use some other method of storing the vertices instead of lists that would be better. The vertices array doesn’t have a fixed size because I’m adding more and more vertices on the fly.
Any help is greatly appreciated!