You may want to read our previous blog about Sorting Layer and Sorting Group before continue reading this.
If you are developing for 2D top down games where the sprites will move from top to bottom or vice versa, sorting layer and sorting group may not enough for you. You will probably face some problem when one of your sprite is moving from top to bottom of another sprite.When the green T-Rex is moving from the bottom to the top of brown T-Rex, it's suppose to render behind brown T-Rex but it does not. Luckily, Unity 3D provided a very convenient settings to solve this problem, it's called the Transparency Sort Mode and Transparency Sort Axis.
These settings can be found from Edit > Project Settings > Graphics. By changing the Transparency Sort Mode to Custom and Transparency Sort Axis's Y-axis to 1, it's tell Unity3D to render the sprites with higher Y position at the back of screen. Now we can see the green T-Rex will render at the back of the brown T-Rex when we move it up.
That's all for today! See you guys again.
Copyright © 2024 Tek Min Ewe