How to render one line on top of another without flickering?
This is probably a really simple question, but I'm trying to understand what's the best way to render one line on top of another (e.g. for a health bar) that are on the same z-plane (in a 3D game). I have two GameObjects, one called Gauge, which should be rendered on top of GaugeBackground.
I would have expected that by setting the depth offset factor to -1 for Gauge, it would always render on top of the GaugeBackground. However, instead, it flickers. This is true even if I set the depth offset factor to 0. I have tried setting the Depth Test to Always, and that does make Gauge render on top of GaugeBackground without flickering, but this seems a bit hacky? I'm trying to understand what's the right way to do this. See below for how Gauge and GaugeBackground are set up.
if you're using an orthographic camera, setting depth units to -1 for the one on top should work.
if you're using a perspective camera you should set depth factor to -1 to handle different perspectives. It seems to work on my end, so I'm not sure what could be wrong on yours I'm afraid!