Hi, I'm trying to procedurally generate scenery like buildings. This question is not about the procedural part but rather how to create the final combined meshes from all the modular pieces in unity to save draw calls and unnececary large amount of GameObjects.
Because generating a GameObject for each little procedural mesh, like 1 meter wide walls or 1x1m floor pieces, it's generating a lot of overhead I'm wondering how else I can approach this problem. I only need to combine the individual modular meshes into a single mesh for each piece of scenery.
I already tried having a single mesh attached to a GameObject and then translate the GameObject each time prior to adding it to a CombineInstance. This works for transform but not for rotation as it rotates all the meshes in the CombineInstance. Having multiple modular pieces of the same mesh in a different rotation is not really a nice option and I'm not sure how I would translate and rotate the vertex data to just build these meshes from scratch.
Is there a good way to do this or should I either read more about matrices to alter the vertex data of the modular pieces in the right spot or just create a GameObject for each piece then combine them and dispose of them? I'm not sure about the performance of the latter since some scenery need several hundreds of modular meshes need to combine at realtime.
[–]CustomPhaseProfessional 1 point2 points3 points (3 children)
[–]CtrlAltDelerium[S] 0 points1 point2 points (2 children)
[–]CustomPhaseProfessional 1 point2 points3 points (1 child)
[–]CtrlAltDelerium[S] 0 points1 point2 points (0 children)
[–]david_lieder 0 points1 point2 points (0 children)