Is There A Simple Way To Make A Sprite Render In Front Of Everything In The Scene? (Unity)
- I have a sprite in the center of my screen
- The sprite is in world space, but sometimes it is obscured.
Occasionally, the sprite will collide with objects that it gets too close to and will be obscured.
There are different options for rendering a sprite in front of everything else in your scene.
- Firstly, you can use two cameras: one for UI and another one for the “normal” scene.
- Furthermore, you could use a shader that has a ZTest of ‘always’ (SL-CullAndDepth). Download the unity shader source and add that ZTest statement to the sprite shader.
- Another option is to put your UI on a canvas that is set to screen space – camera and then set the sorting layer to UI.
- Finally, you can overwrite the render queue on your material. The value for Overlay is 4000