Sprite is covering UI

I have a sprite that is animated by a Shader. When I disable the Shader it goes behind the UI.

There’s a screenshot below displaying the problem

Is this an orthographic project? It looks 3D to me, and I think you’re having z-axis issues.

My game is 2D and my camera is set to orthographic. The sprites don’t go in front of the UI when I set the canvas to overlay instead of camera but I want the post-processing to apply to the UI.

On your UI game object there should be a canvas component. In the canvas component there is a sorting order option.
6822839--792698--upload_2021-2-10_10-43-25.png

I’d say crank that up all the way so when it renders out, it renders above any other sprites that share the same z axis.
The way Unity treats 2D is that everything is on 0 on the z axis so if there are overlapping sprites or in your case UI camera overlay, they will both be trying to render above.

2 Likes

I put the sort order to max but it doesn’t work.

6823907--792869--help.jpg

Hrmm It’s hard to say without seeing the project properly. Is the sprite’s sorting order being changed via shader or a script or anything?

The sprites order in layer is always -14. It seems that when ever I remove the shader the sprite using it goes behind the UI. Here’s the Shader

6828146--793712--oh.png

I found a way to solve this problem :smile:

You should share the solution

2 Likes

Please

1 Like

Please don’t necro posts with useless one-word replies. If you have a question, start a new post, it’s FREE.

When you post you must learn to communicate.

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, log output, variable values, and especially any errors you see
  • links to documentation you used to cross-check your work (CRITICAL!!!)

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379