How to Specify 2D Sprites render Order in Unity

A common problem when it comes to work with 2D sprites is the render order, let’s say we have a sprite for the background and another sprite for the player and when we put them in the scene the background is over the player.

To fix it we have to use the “Sorting Layer” field. Select the GameObject in the Hierarchy > in the inspector select Sorting Layer dropdown and assign the layer. In this case we’re gonna assign the background layer for the background and the foreground layer for the player.

We could have different objects in the same layer, to define the render order in that case you can use the Order in Layer field, the object with the greater number in this field will be rendered in the front.

In case you need more layers you can create selecting the option add sorting later > select the + and adding a name to the layer.

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.