I am making a game with procedurally generated levels and geometry (long trails from some game objects).
Unfortunately, Unity works in a wrong way with modification of mesh attributes (position, colors, etc).
Another posts about the same problem:
http://forum.unity3d.com/threads/118723-Huge-performance-loss-in-Mesh.CreateVBO-for-dynamic-meshes-IOS
http://forum.unity3d.com/threads/111870-Procedural-mesh-update-slow-on-iphone-4
I’m creating a regular grid mesh (440 verts and 798 tris) that is something like a half-pipe with regular grid. I want to colorize a subset of vertices dynamically.
Here some stats from my iPhone 4. Rendering a mesh takes 0.5 ms, but when changing vertex colors each frame (for each vertex) i get 9ms. Using double buffering from posts above improves it to 6ms.
Using colors32 instead of colors not making any difference.
Actually, when I modify any attributes on mesh - vertices, normals, tangents, colors, I get spikes and renderer utilization about 6-9ms.
Maybe it is possible to achieve the same effect using vertex shaders?