Ordering my multi layered sprite characters (2D, Isometric) by the z Axis
Hello everyone!
I have tried to find an answer to this question many places including here on the forums and Have come up empty handed. I am hoping that someone out there can do this as it seems as though it should be a common problem and should have an easy fix.
My problem is as follows:
I have made a bunch of sprites, and animated them inside Unity with idle, attack, die etc. Thats all fine. However once they are in the game they overlap each other incorrectly and partly infront, and partly behind each other.
For this I found a fix in the unite 2014 "best practices video" found here: https://youtu.be/HM17mAmLd7k?t=21m12s
however, as my characters move up and down on the z axis I cannot have them be locked to a a specific layer with the "renderOrderOffset += 1000;" because if I do that then I can end up having chracter A running underneath character B when he is supposed to run over him. There must be some way to dynamically update the sort order of the chracter based on his position on any given axis. So that characters higher up on the screen are on lower layers than characters on lower down on the screen.
The result I want is that no matter how old or new the character is he will always update his sort order based on where he is on the screen. not a locked fixed sort order.
I hope that someone can nail this!