Proper/Standard way to create a top down / isometric sprite sorting solution


For my next game I’m trying to create a game with a camera similar to “Age of zombies, Zelda minish Cap, Hyper light drifter, etc” Top Down tiled ground with sorted sprites for characters, items, npcs, buildings…

Now I wonder whats the proper solution for sprite Y sorting.

I’ve been reading a lot about this topic.

I found two groups:

a) People who approaches the game in pure 2D. Using a “spriteRenderer.sortingOrder” solution, either on late update for each element or for specific elements when they collide to others.

b) People who takes a real 3D solution. Using flat ground (maybe tiled) and sprites facing the camera (you have to update their rotation every time)

I’d like to know whats the best one, I don’t want to take a solution just because you can do it in some way but based on real experience.

What do you think?

Thanks a lot!

Ever since Unity started offering 2D support, I would say that option A became the norm. Option B would’ve been the way of handling it before the support was offered. I would suggest using option A. If things are going to be constantly moving, Late Update may be appropriate, but another option would be to determine if the object actually moved before updating it. For instance, you have a tree that is static. That will never need to have it’s sorting order updated. If you have a person, they may be updated quite frequently, but a non-playable character who just sits in one spot waiting for the player to purchase something from them might not need to be updated at all. Likewise, a box that can be moved by the player should only be updated when it is moved! I would say that you should have a Boolean value stating that the object is moving, and when it’s moving in the Late Update function, set the sortingOrder to the y value. This will be the most efficient way of doing it rather than every object constantly changing their sorting order. You could also have this functionality in a class/component of it’s own and any class needing to sort will have a Require Component Attribute at the top of the class.