Combine static meshes at build time or at runtime. For more information about batching, refer to Introduction to static batching.
You can enable static batchingA technique Unity uses to draw GameObjects on the screen that combines static (non-moving) GameObjects into big Meshes, and renders them in a faster way. More info
See in Glossary in two ways:
To batch static GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary at build time, enable static batching. For more information about batching, refer to Introduction to batching meshes.
Follow these steps:
If you use static batching at build time, Unity doesn’t use any CPU resources at runtime to generate the meshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info
See in Glossary data for the static batch.
Note: Unity uses additional memory to store the combined meshes, even if the meshes are the same. For example, marking trees as static in a dense forest environment can have a large impact on memory. If static batching uses too much memory, combine meshes manually instead.
If a mesh is culled because it’s outside the cameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary view, Unity might not be able to draw all the meshes in a single draw call. This is because the culled mesh leaves a gap in the combined vertex buffers.
To batch static GameObjects at runtime, for example GameObjects you create procedurally, follow these steps:
Select each mesh you want to batch, then in the Inspector window enable Read/Write enabled.
Use the StaticBatchingUtility API to batch the meshes. The StaticBatchingUtility.Combine method combines GameObjects and prepares them for static batching.
Note: To avoid the read/write mesh using double the amount of memory, you can now delete one copy of the mesh by calling the Mesh.UploadMeshData API with markNoLongerReadable set to true.
You don’t need to enable the static batching setting in the URP asset, HDRP asset, or Player SettingsSettings that let you set various player-specific options for the final game built by Unity. More info
See in Glossary.
If a mesh is culled because it’s outside the camera view, Unity might split the batch into two batches, to avoid a gap in the combined vertex buffers.
You can only change the position, rotation, and scale of the whole batch at runtime, not the individual meshes.