Combining meshes multiple times.

Hey guys! I wanna ask, that how to combine children of a gameObject with no material change, or at least other solution. I’m developing a game when player can destroy block, kinda like in minecraft, and I’m creating trees right now, and I ran into a problem, that drawcalls go mad, even with a single tree. So how should I combine the meshes parented to a object, without loosing the material and being able to destroy the parts of the tree? Because I have different material for bark and for leaves, but when I combine them It simply uses the parent’s material. Or should I use another method?.

While Minecraft may look simple, the “obvious” approach of just drawing lots of cubes will have exactly the problem you describe, in addition to a big danger of massive overdraw. You’ll need to be pretty inventive to make it efficient.

One answer would be to separately model a tree as both a full tree (combined), and a partially destroyed tree (as a colllection of cubes), then replace the former with the latter the first time it is damaged, on the assumption that most trees will either be completely untouched or completely destroyed, with only a few in the inefficient collection-of-cubes state.

I doubt Minecraft uses that approach though - it appears designed for arbitrary cubes and for that, I think the only solution would be a custom mesh engine. The closest you’ll get to that with Unity is to modify the mesh from code whenever it is damaged.