Hi I have a body made of sprites. They're all set to the same Sorting Layer and Order in Layer (first is "People" and the second is 0). The trick is all parts of body are on different Z positions. But when I add Sorting Group with the same settings ("People", 0) to the parent of them all, it gets... broken? Everything is in screens. I don't know why it happens. Any ideas? I'm using orthographic camera.
This is because SortingGroup is a 2D component and it uses hierarchy order as a fallback sorting instead of depth.
Hi! When you parent the different Sprites to the parent GameObject with the Sorting Group component, their individual Distance to Camera (Z position) are ignored during the internal sorting process within the Sorting Group; all their Z positions become the same as the Z position of the parent with the Sorting Group component. Since you gave them all the same Sorting Layer and Order in Layer values, they are sorted together on the 'same' layer and their render order became jumbled. Ideally, you should give each of the Sprites a different Order in Layer value so that they are sorted in the correct Render order, while remaining on the same "People" Sorting Layer.