Search Unity

Tutorial - Static Batching, Explained. Free, Powerful Draw Call Optimization

Discussion in 'Community Learning & Teaching' started by ChrisKurhan, May 23, 2023.

  1. ChrisKurhan

    ChrisKurhan

    Joined:
    Dec 28, 2015
    Posts:
    268


    Static Batching has been around in Unity basically forever. It combines static meshes together to send them to the GPU in "batches". Typically, each individual object has to be sent to the GPU in a single Draw Call. This can create a bottleneck with the CPU and GPU talking back and forth too much.

    By marking meshes "Batching Static" (top right of inspector) you indicate to Unity that it should consider this mesh as one that does not move and a candidate to be batched statically. When entering play mode, or at build time, Unity will review your scene and combine meshes that meet certain criteria (some listed below).

    Benefit: Reduced Draw Calls and Batches.
    Limitations: Static Geometry, Same Materials, affected by same Light Probes and Reflection Probes, only so many vertices per batch (64k).

    As with all performance optimization techniques - you mileage will vary based on your individual scene complexity, setup, and what else is going on. This can dramatically reduce draw calls and batches (one demo scene in the video, for example, goes from ~3k draw calls & batches to ~1.5k draw calls ~200 batches).

    I hope this helps somebody with their optimization pass!