I am experimenting with Hex grid layouts and testing the most efficient way of building a hex map.
I tried 2 things:
- Build my own hex mesh using 6 triangles and 7 vertices
- Use blender to create a Hex and import it
For 1. The mesh renderer I created is attached to an object prefab and I instantiate one for each Hex in my grid. 2 is almost similar but I imported the .fbx model from blender and I created a prefab from it. Then instantiate one per hex in my grid.
Question: Why is the Blender approach giving me better performance then when I create the meshes myself?
When I use the first approach with the meshes I created, I'm getting around 44FPS
But when I use the Blender approach I get around 60 FPS
Info on how I'm creating my meshes. I create 7 vertices, Marked on this screenshot from 0 to 6
Then my triangles will be:
List<int> triangles = new List<int>() {
0, 2, 1,
0, 3, 2,
0, 4, 3,
0, 5, 4,
0, 6, 5,
0, 1, 6,
};
//Create the Mesh
m_mesh = new Mesh();
m_mesh.name = "Hex";
m_mesh.vertices = vertices.ToArray();
m_mesh.triangles = triangles.ToArray();
m_mesh.uv = uvs.ToArray();
m_mesh.RecalculateNormals();