O'Reilly logo

Unity 5.x Game Development Blueprints by John P. Doran

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with sorting layers

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:

  1. Select one of the background objects from the Hierarchy tab and then from the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required