In my UI framework that I am making, I use something similar, however I don't sort them. I use the depth buffer in DirectX to do it for me, and I just store a depth.
Great tutorial! I feel like it might be worth pointing out that your game will crash if you don't check if your GameObject, Skeleton, and Building arrays are null before trying to render because you'll try iterating over a null array. I was following the tutorial and noticed that my game mysteriously crashed whenever I walked over a specific part of the map-- it turns out I was walking over the door and the game crashed since the Building and GameObject arrays were set to null for the indoor map I believe. Hope that saves someone some troubleshooting!
In my UI framework that I am making, I use something similar, however I don't sort them. I use the depth buffer in DirectX to do it for me, and I just store a depth.
Great tutorial! I feel like it might be worth pointing out that your game will crash if you don't check if your GameObject, Skeleton, and Building arrays are null before trying to render because you'll try iterating over a null array. I was following the tutorial and noticed that my game mysteriously crashed whenever I walked over a specific part of the map-- it turns out I was walking over the door and the game crashed since the Building and GameObject arrays were set to null for the indoor map I believe. Hope that saves someone some troubleshooting!
Cheers mate
Not last but not second
Second but not first
first but not the last
Forth, but not third.