Drawing in game - 2D drawing behind sprites


I’m not sure if I’m missing something obvious here. I’m using ALINE to draw while prototyping (currently drawing a 2d game grid using solidPlane and lines), and can’t figure out how to get this to render behind regular sprites (just using Unity’s default SpriteRenderer). Is there something special I need to do for this, or am I using the wrong drawing functions?


I would try render to RenderTextures and use RawImage to display it, or use depth setting on camera

ALINE will by default render things with a lower opacity behind objects (adjustable in the project settings). However, this only works if the objects write to the z-buffer.

Thanks guys, got it working with a custom sprite shader that writes to z-buffer

1 Like