Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Batching and Sorting Groups

Discussion in 'Universal Render Pipeline' started by KMacro, Sep 17, 2019.

  1. KMacro


    Jan 7, 2019
    I have a prefab that contains a root object and two children with Sprite Renderers (a palm tree with its trunk in the first child's sprite renderer and its leaves in the second child's sprite renderer to make it easier to visualize).
    Three of these palm trees are children of another object "BackgroundElements".

    I would expect the drawing of the trunk sprites to be batched and the drawing of the leaf sprites to be batched, and this is the behavior I see in the Frame Debugger. However, if I add a Sorting Group component to BackgroundElements, this batching breaks and I see the following draw order: Trunk 1 -> Leaves 1 -> Trunk 2 -> Leaves 2 -> Trunk 3 -> Leaves 3

    Is this just an unfortunate side effect of using the Sorting Group component, or is there a way for me to get Unity to batch the draw calls in the same way I see without the Sorting Group component?

    All of the Sprite Renderers are on the default layer with sorting order 0. I am using Unity 2019.1.10f and LWRP 5.7.2.
  2. modernator24


    Apr 7, 2017
    I'm also interested this in. Is there any news about this? After using the sorting group, my batching also broken, and draw call increased a lot.
  3. Tony_Max


    Feb 7, 2017
    Is it even possible to batch sprite rendering if they use an arbitrary sort order among themselves? There is an old thread explaining batching.
    Last edited: Sep 2, 2020