Control Sprite Rendering Order (Which 2D Objects Show in Front) | Unity 2018 Tutorial

preview_player
Показать описание
► My Unity 2020 Mini-Course - Make a 2D Platformer Character with State Machines ►
◢◤◣◥◢◤◣◥◢◤◣◥◢◤◣◥
Let your character go in front of or behind objects depending on their vertical Y position in your game. This simple code lets all of your objects sort out which one is suppose to show in the front.

See My Full Software Courses

➣ Also Follow Me On

➣ If you like my videos, you can support the channel directly
Bitcoin: 17Pn5PifFmRkHRAqCZQAom1ZjCiSf7qJjJ
Ethereum: 0x6f2781F382952c8caCDbE99C46F07c265ab59627
Steem: @christutorials
Рекомендации по теме
Комментарии
Автор

Unity has an already implemented way of doing this, you don't need to code anything. Just go to Edit > Project Settings > Graphics > Transparency Sort Mode: Custom Axis and set Y to 1. It will automatically sort sprites based on the Y axis.

piskipa
Автор

This in no way solved my problem, which was completely unrelated, but it is extremely helpful, and I’m glad I found this

trackernivrig
Автор

thanks man, i was searching this for days!

spagettzeera
Автор

Really helpful. Thanks a lot, I've been struggling with this for a couple of days and this solution works great

davidcollado
Автор

Hello, thank you very much.
Did you find a way of getting all renderers without calling the method every frame (TODO comment) ?

faithium
Автор

This is exactly what I needed. Thank you!

pepaokurka
Автор

This is really helpful, thank you for making this!

winter
Автор

Sorry, but using FindObjectOfType in Update statement is not the best practice.

syswowrg
Автор

00:08 hey bro that's too heavy particles

pedro
Автор

Changing layers in code just to sort is a lot of work and inefficient. Use Pivot sorting as it is much easier to implement, doesn't require any code and is efficient

luqman_azeem
Автор

Does this work with Unitys TileMap System? Im struggling on getting it to work

MrSteamLp