Version: Unity 6.1 Alpha (6000.1)
Language : English
Batching static GameObjects
Enable static batching

Introduction to static batching

Unity can perform 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
at build time and at runtime. As a general rule, if the 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
exist in a sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
before you build your application, use the Editor to batch your GameObjects at build time. If you create the GameObjects and their meshes at runtime, use the runtime API.

When you use the runtime API, you can change the transform properties of the root of a static batch. This means that you can move, rotate, or scale the entire combination of meshes that make up a static batch. You can’t change the transform properties of the individual meshes.

To use static batching for a set of GameObjects, the GameObjects must be eligible for static batching. For information about how to set up renderers so Unity can batch them, refer to Using draw call batching.

To use static batching for a GameObject, the following conditions must all be true:

  • The GameObject is active.
  • The GameObject has a Mesh FilterA mesh component that takes a mesh from your assets and passes it to the Mesh Renderer for rendering on the screen. More info
    See in Glossary
    component, and that component is enabled.
  • The Mesh Filter component has a reference to a 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
    .
  • The mesh has a vertex count greater than 0.
  • The mesh has not already been combined with another Mesh.
  • The GameObject has a Mesh RendererA mesh component that takes the geometry from the Mesh Filter and renders it at the position defined by the object’s Transform component. More info
    See in Glossary
    component, and that component is enabled.
  • The Mesh Renderer component does not use any Material with a shaderA program that runs on the GPU. More info
    See in Glossary
    that has the DisableBatching tag set to true.
  • Meshes you want to batch together use the same vertex attributes. For example, Unity can batch meshes that use vertex position, vertex normal, and one UV with one another, but not with meshes that use vertex position, vertex normal, UV0, UV1, and vertex tangent.
  • The mesh is read/write enabled. Refer to the Mesh-isReadable API for more information.

For information about the performance implications for static batching, refer to Performance implications.

Static batching is more efficient than dynamic batchingAn automatic Unity process which attempts to render multiple meshes as if they were a single mesh for optimized graphics performance. The technique transforms all of the GameObject vertices on the CPU and groups many similar vertices together. More info
See in Glossary
because static batching doesn’t transform vertices on the CPU. For more information about the performance implications for static batching, refer to Performance implications.

Requirements and compatibility

This section includes information about the render pipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary
compatibility of static batching.

Render pipeline compatibility

Feature Universal Render Pipeline (URP) High Definition Render Pipeline (HDRP) Custom Scriptable Render Pipeline (SRP) Built-in Render Pipeline
Static Batching Yes Yes Yes Yes

Performance implications

Using static batching requires additional CPU memory to store the combined geometry. If multiple GameObjects use the same mesh, Unity creates a copy of the mesh for each GameObject, and inserts each copy into the combined mesh. This means that the same geometry appears in the combined mesh multiple times.

Unity does this regardless of whether you use the Editor (refer to Enable static batching at build time) or runtime API (refer to Enable static batching at runtime) to prepare the GameObjects for static batching.

If you want to prioritize a smaller memory footprint, you might need to reduce rendering performance and avoid static batching for some GameObjects. For example, marking trees as static in a dense forest environment can have a serious memory impact.

Note: Each static batch can include up to 64,000 vertices. If there are more, Unity creates another batch.

Batching static GameObjects
Enable static batching