First of all. My english is not very good, so i’m sorry for the inconveniences. If you need me to explain something again, there’s no problem.
So, here we go:
I have passed the last week experimenting with a celular automata for creating a “minecraft like” grid with hexagonal columns
My problems starts when i instantiate it.
I have a empty game object and all the hexBlocks are their childrens. My first attempt to do a big composition of bloks made me realize that i have a performance isue.
Here you can see how it looks:
And then the troubles start:

13 FPS are not enough and more taking into account that we are in an early stage of development. No textures, no complex forms, no animations etc. There is a lot of bathes too. So i start digging into the internet.
The first thing that i tried was too enable GPU instantiating for the material of the hexPilars.
The bathes count improves a lot, but not the FPS count:

Next step, combine meshes:
I use the code in the unity manual example (here):
MeshFilter[] meshFilters = GetComponentsInChildren<MeshFilter>();
CombineInstance[] combine = new CombineInstance[meshFilters.Length];
int i = 0;
while (i < meshFilters.Length)
{
combine[i].mesh = meshFilters[i].sharedMesh;
combine[i].transform = meshFilters[i].transform.localToWorldMatrix;
meshFilters[i].gameObject.SetActive(false);
i++;
}
transform.GetComponent<MeshFilter>().mesh = new Mesh();
transform.GetComponent<MeshFilter>().mesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
transform.GetComponent<MeshFilter>().mesh.CombineMeshes(combine);
transform.gameObject.SetActive(true);
Now the performance is great:

But… Now i dont have a collection of interactuable game objets. I have a single game object with the apareance of many.
I need to have multiple objects in order to interact with them, mining it, selecting it, highligting it, and probably more things that i have dont think yet.
And this is the question: ¿How can i get performance in this scenario, and preserve my capacity of work with independent gameobjects?
Thanks in advance.


