If you are using world space UI together with Linework, you might bump into some issues where the outlines are shown on top of the UI.
This occurs because the world space UI uses a shader that does not write to the depth buffer. Because of this, the outlines can not ‘detect’ the world space UI and can not render behind the UI by checking the depth buffer.
Render Before Transparents
The solution for this is to make sure the outlines render before the UI does.
To enable this injection point, open RenderUtils.cs
and add this to the InjectionPoint
enum.
[InspectorName("Before Transparents")]
BeforeRenderingTransparents = RenderPassEvent.BeforeRenderingTransparents,
In a future update this will be added so you don’t have to add it manually.
This will make it so the outlines are rendered before the UI and so the UI renders on top of the outlines (white square is UI image here).
ZWrite in UI shader
An alternative is to modify the UI shader so that it writes to the depth buffer. Then the outlines can take the world space UI into account.
However, I’m not sure if adding ZWrite On
to the UI shader could have some unexpected side effects so keep that in mind