- Home /
Sprite in front of background but behindbuttons issue.
Hello. I want to make dynamic background so I am creating sprites (clouds) at random heights and camera goes to the right so it looks like clouds are going behind menu. But there is one problem. That clouds are in fron of UI elements such as buttons. And i don't know how to make them to be in front of background image on canvas and behind buttons. Someone can help me?
This cloud i want to be behind that button.
This is my scene elements hierarchy. Cloud is sprite and others are UI elements.
Answer by FernandoHC · Sep 10, 2018 at 12:56 PM
If your game doesn't require camera movement, I'd go against your current technique and move the cloud instead.It is a lot easier to manage in the future and you can have different moving speed clouds.
Just make the cloud a non canvas sprite, give it a rigidbody and translate it. It will be rendered behind canvas items as default.
Yes i realized that and now i have it as you said. But clouds are still in front of UI components. I need really some advice from the start how to setup canvas to camera and all UI elements and sprites to be able to get this. Please someone.
Now i realized what make that problem. It was background simply. But i have only background with solid color so i remowed that UI and set color to camera view.
Cool, hope it is working now. In case you're still having issues, check the Sorting layer and Order in Layer values in the Canvas.
Your answer
Follow this Question
Related Questions
Sprites/Diffuse shader overlap problem 0 Answers
is there any way to group sprites? - Unity2D, 1 Answer
Sorting Layers in a 3D Environment 1 Answer
Rendering a camera in front of a gui element 3 Answers
Sprite Layers 2 Answers