Search Unity

Static batching doesn't work like expected

Discussion in 'Editor & General Support' started by TeohRIK, May 24, 2017.

  1. TeohRIK

    TeohRIK

    Joined:
    Jan 22, 2014
    Posts:
    89
    Hi,


    I having a test scene with 4 tile of floor and some debris on top of it, the floor has the lightmap and batching static flag but the debris only set with the batching static flag. They all sharing the same material and the scene is using Realtime Lighting previously known as precomputed realtime GI and using deffered rendering(because I need it for my game).

    Well, from what I was thinking, it only need to use 1 draw call to render this 4 tile of floor and some debris because all of it are set as batching static and sharing the same material then suppose it will be batching all together. But after I check with the frame debugger, it actually take 15 draw call to render the 4 tile and debris



    Unity 5.6 has been updated with new frame debugger which showing why it can't be batched, I checked every draw call and their reason why it cant be batched, all of it is showing "Objects are lightmapped", I don't really understand what it mean, any clue how to make it to 1 draw call?



    thanks
     

    Attached Files:

  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,195
  3. IgorAherne

    IgorAherne

    Joined:
    May 15, 2013
    Posts:
    339
    EDIT (removed what I wrote in this particular post)

    I received a reply from unity support. Static batching is designed to only work during Play mode.
    It won't work unless you are actually playing the game in editor.

    Hit play, and it should be working. Create Lightmap Parameters asset, and assign the same one to objects that should be batched together (google about its SystemTag property)
     
    Last edited: Mar 25, 2019
    jrumps likes this.
  4. Peter77

    Peter77

    Joined:
    Jun 12, 2013
    Posts:
    3,595
    MNNoxMortem likes this.