https://github.com/shamim-akhtar/sorting-sprites-renderorder
In this tutorial, we will learn to implement runtime depth sorting of sprites in a layer.
https://github.com/shamim-akhtar/sorting-sprites-renderorder
gamedev unity2d
Last synced: 7 months ago
JSON representation
In this tutorial, we will learn to implement runtime depth sorting of sprites in a layer.
- Host: GitHub
- URL: https://github.com/shamim-akhtar/sorting-sprites-renderorder
- Owner: shamim-akhtar
- Created: 2021-09-01T03:47:24.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2021-09-01T11:37:55.000Z (about 4 years ago)
- Last Synced: 2025-01-17T22:25:35.076Z (9 months ago)
- Topics: gamedev, unity2d
- Language: C#
- Homepage: https://faramira.com/runtime-depth-sorting-of-sprites-in-a-layer/
- Size: 8.36 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Runtime Depth Sorting of Sprites in a Layer
In this tutorial, we will learn to implement runtime depth sorting of sprites in a layer.
Typically, you can associate a RenderOrder to a sprite in Unity editor. However, there may be situations where you would want to reorder the sprite render order, and set the correct z value at runtime based on the sprite that you select or pick in-game.
For example, in a Jigsaw game, all the tiles can be in the same layer with the same depth. However, based on which tile you pick, you want to bring it up in the render order to draw it on top of all other tiles and set the correct z value so that raycast can also pick it up even if it overlaps with other tiles.
By the end of this tutorial, we want to achieve the following:
* Click a sprite and bring it to the top,
* Click and drag to move a sprite,
* Click and pan camera when the click on not on any sprite, and
* Slider to zoom-in and zoom-out of camera (optional buttons to do the same)