- Home /
Improve sorting-order change in 2D top-down
Hello, I'm trying to make a 2d topdown-thing...
So here's my problem: My character should appear in front of and behind objects, so I have to change the sorting layer.
I know one solution for this. Always check the characters Y and the cbjects Y position --> if the chacacter's Y has the higher amount it's sorting layer is lower than the object's. BUT I don't want to check that every time. That's not very effective...
Any ideas how to improve this system?
Greetings,
Nagh
Answer by BRW_arjan · Oct 04, 2019 at 09:59 AM
There are so many things going on every frame that just checking a Y value of 2 objects is no biggie.
But aren't Unity camera's and Z-buffers supposed to do things like that for you?
You're right with the process not taking much ressources, but in my view the solution isn't very elegant... but I'll tro to mess around with z-uffers and depth-textures, likeyou said
Your answer
Follow this Question
Related Questions
Isometric Tilemap Characters Z-Fighting Causing Flickering 1 Answer
Place UI text on top of other elements in 2D 1 Answer
3D object in 2D game 1 Answer
2d Animation not rendering in front of background sprite in spite of sorting layers 1 Answer
Allow for sorting between different sorting layers 0 Answers