- Home /
Renderer sortingOrder performance question
Hello,
First, I'm sorry if this was asked before.
My question is on the intrinsic details of how sortingOrder works. If I had to make a wild guess, Since sortingOrder is a property and not a field, I would assume that each time you change the sortingOrder, the engine does the following internally:
Check if the new sorting order is different
If it IS different, then change the order of the sprite in some sort of internal structure that defines the order of sprites to draw. This operation is potentially expensive, which is why step 1 is required.
I don't know if the above is true. However, it wouldn't make sense for the engine to sort sprites on EVERY frame, so I assume that Unity does keep some sort of a hidden structure. So, my question is, is there a hidden overhead when changing sorting order, and if so, in what cases?