Unity DrawMeshInstancedIndirect 2D Quads - How to sort draws by Y axis?

68 Views Asked by At

I'm drawing around a million 2D quads using DrawMeshInstancedIndirect - - think like im using it for grass. Now I want it to be drawn on top of one another based on Y coordinate, but I can't get it to do that. (It doesn't obey the custom sort axis in the Project settings either!) Whatever is drawn first is drawn over the ones that follow. Now i want to be able to draw my player quad and like tree quads such that grass goes behind/in front of them based on the Y coordinate. Is there a way to do that?

I've tried changing the custom sort axis. One possible hack is to set the z the same as Y but thats not a solution, and I don't want to do that.

0

There are 0 best solutions below