Next, I want to ensure that the sprites that we added will actually be in the correct order from any of the other sprites that we add to the level. This is because when we place objects on the same Z position, we are telling the graphics card that we don't care what order the images are drawn to the screen (also known as z-fighting). In this case we do and even if it "looks right" in the editor right now, if you ever load or restart the scene it may not look correct so rather than wait for the problem I suggest we fix it now. I could change the Z position of the object, but rather that, we can make use of the sorting layers property instead:
Select one of the background objects from the Hierarchy tab and then from the Inspector tab, go to the Sprite Renderer component and click on the Sorting Layer dropdown. Then, select Add Sorting Layer… click on the + icon two times and name the newly created layers
Background
andForeground
. From there, bring theBackground...