Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

5.6.0b4: Debugging your batches with Frame Debugger

Discussion in '5.6 Beta' started by yuanxing_cai, Jan 19, 2017.

  1. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    People always say Unity's dynamic / static batching is a black box. There are tons of rules that you need to bear in mind for batching to work, but even if you seemingly honor each and every rule listed on the manual page, sometimes you still get broken batches, and there is little you could do to debug this.

    So in 5.6.0b4 we added a piece of information to draw call events in Frame Debugger that tells you why a draw call can't be batched with the previous one.

    Here is a simple example to show you how it works:
    Untitled-1.jpg
    We have two cubes that could be dynamically batched if they weren't using different materials. If you select the second draw call, there is this new information on the right side panel telling you why they can't be batched. In this case, it's because they use different materials.

    This case might be too obvious for you to be needing a tool to tell the reason, but there are more non-trivial, 'hidden' reasons a batch can break in Unity. Currently in 5.6 beta 4 frame debugger can detect 25 different batch break causes in various places in our forward, deferred and shadow render loops.

    We hope this little addition to frame debugger can ease your pain when trying to debug batching problems in Unity. Try it with your scenes and tell us what you think about it. Moreover, any feedback regarding frame debugger / general diagnostics tooling around graphics is welcome in this thread.
     
  2. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Fantastic - thank you for adding this. The other thing that often prevents us from getting the answers we need from the frame debugger are trying to find out which Renderer a given draw call is tied to. Especially when using uGUI where a preview of the mesh does no good, we often have some draw calls in the frame debugger that we simply can't explain. It would be great if selecting a draw call in the frame debugger pinged the object in the hierarchy that is responsible for it, or something like that.
     
  3. yuanxing_cai

    yuanxing_cai

    Unity Technologies

    Joined:
    Sep 26, 2014
    Posts:
    335
    Frame debugger always has this function (pinging object in Hierarchy window) as far as l can remember. If it doesn't work that way, it's a bug.
     
  4. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    @yuanxing_cai - it definitely does not do that for Canvas elements. I guess it's possible that it does for regular 3d meshes? I will check and see.

    This was also acknowledged in person in our last on-site visit from Unity field engineers, too. I'll submit a bug with a trivial repro project if that would help.
     
    JonSWEDEN likes this.
  5. Elecman

    Elecman

    Joined:
    May 5, 2011
    Posts:
    1,374
    Great add! looking forward to play with it.