Is there a simple way to make a sprite render in front of everything in the scene?

  • I have a sprite in the centre 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
More Information
Was this article helpful?
1 out of 2 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.