Hello everyone,
Info
I am making a game similar to Don’t Starve graphic-wise (Bill boarded 2D sprites inside a 3D environment) (Picture)
However I am using an orthographic camera as opposed to perspective with a 45 degree rotation around x-axis
The Problem
I noticed that some small sprites appear behind bigger ones even if they are positioned in front of them. After some research, I found out that Unity renders sprites based on the distance between the camera and CENTER of the sprite, therefore, with my camera setup, taller sprites will have centers that are closer to the camera. That is why this does not happen with objects that are the same height.
My theoretical solution is to tell Unity to order sprites only based on their z position. That would work best but I do not know how to do that (in an efficient way). Any ideas?
My one (probably bad) idea was to set the sprites’ sortingOrders to their z position times like 1000. I just do not find that clean and I am not sure what effect it has on the performance, therefore it will be my last resort.
Thank you in advance! ![]()