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?
3 out of 5 found this helpful
Have more questions? Submit a request


  • 0
    Jeremy Harford

    Setting the render queue is particularly useful when dynamic meshes and procedural materials are used to affect sprites by sticking them to the camera; such as needed presently to create a pure ECS UI.  In such cases, we're playing a game where we squeeze the best performance possible from our software, so using multiple cameras is out right off.  We don't have access to the sprite shader, as the Sprite Renderer is decidedly not RenderMesh.  And naturally, using a canvas is impossible because none exists for ECS. 


    Having unnecessarily rambled at length about that, recall that when your shader is changed, you will have to set your render queue again.  It's easy to forget if you don't do it by habit.  

Please sign in to leave a comment.