Multi sprite characters order themselves as a whole rather than as individual parts

So I have a bunch of zombies that are made out of several sprites so that it’s easy to animate and change parts around. The zombies themselves layer fine but when multiple zombies are near each other the individual parts of each overlap and this causes layering problems.


The only solution I can think of it to change the order in layer of every individual part of a zombie each time one spawns but that seems really inefficient. Is it possible to have the zombies order themselves instead of each individual part? So one zombie will be completely on top of another rather than only half of him being on top.

Change the order of layer for each individual part for each zombie. Pseudo code as follows:

static int zombieNumber;

void Start (){
    zombieNumber ++;
    foreach (sprite in zombie){
        sprite.sortingOrder = sprite.sortingOrder + 100 * zombieNumber;

You can go as high as you want (almost) with sorting order. So there shouldn’t be any problems with this approach.

I tried this…in game mode it shows it works, they’re at separate sorting layers but they still overlap?