1
votes

I am having a problem with my unity canvas as my background is on top and covering my gameobjects. I have tried putting the canvas sorting order to -10000 and changing the canvas rendering mode to overlay/camera/worldspace, but none of them works..

This is how my game looks like right now: as you can see the white image which is my background is covering my gameobjects..

Attached are my component values for my canvas: my canvas

Attached are the values for my camera: my camera

Attached are the component values for my gameobjects: my hero gameobject

3

3 Answers

0
votes

Have you tried setting your game objects z position to a negative value?

For 2D games in Unity, the more negative your Z value is, the "closer" it is to the camera. If you try setting your knight to something like -1, it should no longer be obscured by your background.

Also, make sure to set the camera for your canvas' render camera and you can set the sorting order back to whatever it was before. Just check the individual pieces attached to your canvas to make sure their Z positions aren't "in front" of the game objects.

0
votes

The background for your game shouldn't be on the canvas, it should be a gameobject with a sprite renderer and need to be attached with a sprite(background image) with a resolution that will fit most mobile screens (assuming you build it for mobile phone, i personally prefer making it 1028X720)

if you still insist on putting it on the canvas then you could set the canvas render mode to world space and set the sorting layer to something less than default or sort order -1

0
votes

I know it is old post but @user8502296's answer saved me so I wanted to contribute. I changed the Canvas->RenderMode->Screen Space-Camera then I added Render Canvas->Camera->Main Camera.

Canvas