Game Development Reference
In-Depth Information
The Sprite Renderer and Sorting Layer
In the Sprite Renderer , we will see that there are two Layer properties, Sorting Layer
and Order in Layer , which will help us sort the depth of our sprite and tell Unity which
sprite should be drawn first (the lower number will get drawn first). We only use the
Order in Layer property to sort the depth of our sprite in the same layer group. So, here's
when Sorting Layer comes in handy.
If we go to Edit | Project Settings | Tags & Layers , we will see that there is Sorting
Layers . This is the new feature in Unity so that we can set our sprites in this layer group
and tell Unity which layer group should be drawn first. For example, we can set the back-
ground layer to contain all the background sprites and then set the foreground layer to
contain all the foreground sprites. This way we will always know that the foreground
sprites will be drawn after the background sprites, as shown in the following screenshot:
Search WWH ::




Custom Search