I’m creating a mesh for a rounded cube in code (it has 216 vertices, normals etc). And I want to have 100 cubes on screen in my game.
So can (and should) I just run the mesh creation code once to create a mesh and then just assign that mesh to the mesh property of the MeshFilter of each object? Or should I run the createMesh code for each of the 100 cubes, or should I clone the mesh for each object, somehow?
ie
mesh = CreateMesh()
for each object
{
meshFilter.mesh = mesh;
}
OR
for each object:
{
meshFilter.mesh = CreateMesh();
}
Any advice appreciated.
I may want to change the mesh for some objects during the game (eg change the roundness of the cube), so maybe I would then clone the mesh, change it and reassign it for that single GameObject?