2D-Sorting; Does batching affect the order of 2D-Renderers?

Hello Unity-community :slight_smile:

I was reading the documentation about the 2D sorting process: Unity - Manual: 2D Sorting

On that page there are listed several criteria how the 2D sorting process determines the order of 2D-renderers. So far so good :slight_smile:

One of these criteria is:


Unity sorts Renderers with the same Material settings together for more efficient rendering performance, such as with dynamic batching

After I researched a lot about (static and dynamic) batching I couldn’t identify, how exactly batching affects the order of 2D renderers. However, I figured out, that the order of 2D renderers can break batching but that is not relevant for me at the moment.

Therefore, my question: Does batching affect the order of 2D-Renderers at all?
And if so, how exactly does it affect the order of two overlapping SpriteRenderer with identical sorting options (same sorting layer and same sorting order)?

Additionally, what would happen, if one or both of these SpriteRenderers can be drawn by using batching?

Thank you very much!

Okay after some research, I’m answering my own question :slight_smile:

Batching is about increasing the performance of what needs to be rendererd. By doing so, batching always guarantees the order of renderers set within the scene. In every render-process, batching is tried to be used, but breaks as soon as necessary conditions (e.g. same material, …) are no longer met. This means that batching affects the performance of the rendering process, but not the order of the renderers to be displayed.

I couldn’t find out, what exactly happens with overlapping and unsorted renderers. If anyone finds more information on that, please write a comment :slight_smile: