Spriterenderer on top of canvases

I have two canvases. One with a background image and one with all overlaying elements like texts and such.

The background canvas has an order of 0, the overlay canvas of 1.

Now, I’d like to create an animating sprite on top of those canvases but I can’t for the life of me get the sprite on top of the other images.

I can see the sprite being on top on the stage, but when I switch to gameview, it’s gone! There are no scripts attached to the sprite. Only an animator(Which works fine when I play it).

Note:

  • My canvases have a render mode of
    Screen space - Overlay.
  • I’ve set the spriterenderer on
    Sorting Layer 9, order 300. Although
    it’s the only sprite out there.
    layer 1 or order 1 didn’t do anything
    different, though.
  • The other elements in the canvases are either UI texts or Images
  • All the elements in the canvases are on either BackgroundLayer or OverlayLayer
  • The canvases themselves are on the UI layer

Try using different cameras, or using World space as the render mode. I am assuming here that this Sprite is in the scene, not in any canvas.
I can explain using different cameras:

You can have multiple cameras in the scene, and they have a render depth which defines in what order they are drawn on screen. We can have our normal camera render the canvas’s and other scene objects, we will set this up now!

We then create a new camera, in the same location (maybe as a child of the main to make them always move together). We can use the culling mask feature, where we can (by using layers) to define what this camera can see. We take the sprite and place it on separate layer and define that as all that camera can see. We also remove that layer from the main camera.

We now on the new camera, change the clear flags to not clear, so we can see the main cameras stuff. Lastly we set the depth to higher than our main camera. This makes sure it renders above the other cameras objects.

And that should of worked!! Please say if i miss-understood or it doesn’t make sense!

NOTE: You may have to change the render mode of the canvas’s from screen space overlay to Screen space camera, otherwise Unity renders the UI over everything, which is not what we want.

The above answer is corrent but one thing that is forgotten is: Go to Canvas → Render Camera: "Select the new Camera where Culling Mask is assigned at the designated layer