I am new in using Unity. I’m really getting confused by the “sorting layers”. I have created four sorting layers, and assigned the “Background” layer to the main camera’s Background, “Foreground” layer to all tile prefabs and the “Player” sprite, but I can see the tiles only in the scene view not in the game view. Thank you if someone can help me this out!
sorting layers
scene view
I suspect they are behind the camera in the Z axis. Check your camera position and tile positions and see if it is out of whack with the that which does show up.
You are right, I have changed the z depth of the Main camera to -1, and the “Background” of the camera to 1, cannot be 0, I think it is because there is another layer which is the Skybox whose depth is 0. But this still confuse me, because it should be their sorting layers determine which layer will be rendered on top of each other right? All my tile prefabs has a higher sorting layer than the camera background, it was covered by the camera background.
Ok, now it is fixed, I don’t know why, the problem has gone, I just exchanged their sorting layer then changed them back, and it’s gone. Thank you very much!!
I think @Derekloffin might have meant this. One reason you might not see objects is if they are behind the camera near clip plane… although I have no idea if that is the case here.
I’m still a bit unsure how 2D sorting works myself, but my impression has been that Z > Sorting layer > sorting order as far as how sorting works. Usually everything in your 2D game with have the same Z (save the camera) so that usually shouldn’t matter, but the Z coordinate still does exist and does do things. Best thing is to just avoid the issue by having all your 2D assets have the same Z position, usually 0.
The SceneView camera and the Camera used in the GameView are different, so you could see different results. Selecting the GameObject of the Camera will add an overlay which you can check if there is a Camera settings issue.