Combined Mesh vs Multiple Objects sharing material

I’ve been creating simple objects with 3D cubes and placing them together, 1 cube in each game object, to form simple shapes, however some objects are being copied, which gets too many game objects on the scene

Performance wise, does unity treats a combined mesh same with as several gameobjects using the same material / texture?
Should I combine all meshes in the object or use a modeling tool?

Thanks in advance

You can toggle on Static Batching in the gameobject’s Inspector Panel. Generally unity will combine meshes for you. Unity will do the best,but some transparent material maybe break a drawcall(dont care about this, small problem). An advantage of unity’s static batching is Camera View Frustum Culling, this will improve great performance. And you can modify scene at any time.

If you are donot familiar with relevant concepts , let unity do this for you.

2 Likes

Thanks for the tip! If I instantiate the game object (with separated cubes) with static batching on, does unity will combine the prefabs as well? or it just combines the ones already pre loadead in scene?

There are two types of batching. Static batching combines two or more meshes that share the same material and is set to “Batching Static” in your scene. This happens at build-time. The other is dynamic batching which’ll combine meshes on-the-fly, including those imported during run-time, but at the cost of additional overhead. This is automatic assuming your mesh/material combination meets the criteria.

https://docs.unity3d.com/Manual/DrawCallBatching.html

Unity donot combine prefabs in the project panel。You must invoke StaticBatchingUtility.Combine, but at the cost of additional overhead。