YSort with either MultimeshInstance2D or RenderingServer?

Godot Version

4.3 Beta 1

Question

Hello!
I’m playing around with an RTS project where I’m rendering thousands of units. I’m currently using MultimeshInstance2D to render the units but getting them to render in the correct order (units with lower Y position in front) is hard to achieve efficiently.

Currently I sort the units from highest Y to lowest and then render them in that order. The sorting is a lot slower than I would like since I lose data locality.

Ideally I would like a way to independently sort the units without knowing anything about the others. Basically a way to set the Z-coordinate of the textures… in a 2d world. Or would a 3d world with an ortographic camera be the go-to?

Thanks!

Note: By low Y I mean graphically appearing to be lower, reversed Y et cetera…