Sorting Layers and Sorting Order Explained (Unity 2D)

preview_player
Показать описание
Let's learn all about how 2D Sorting works with Sorting Layers and Sorting Order.
👍 Learn to make an awesome game step-by-step from start to finish.

🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!

If you have any questions post them in the comments and I'll do my best to answer them.

See you next time!

#unitytutorial #unity3d #unity2d

--------------------------------------------------------------------

Hello and welcome, I am your Code Monkey and here you will learn everything about Game Development in Unity 2D using C#.

I've been developing games for several years with 7 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.

--------------------------------------------------------------------

Рекомендации по теме
Комментарии
Автор

🌐 Have you found the videos Helpful and Valuable?

CodeMonkeyUnity
Автор

💬 2D Sorting! Essential to know how it works so you can keep your games nice and organized.

How many layers do you normally use? For me, Background, Default and Top is usually enough.

CodeMonkeyUnity
Автор

You are a lifesaver man. I would have never guessed the bottom layer would go at the top of the list

arc
Автор

As usual, a very clear video on a well-defined subject. It's saved time for those who watch it. Even though I didn't learn much during this viewing, thank you very much. I recommend it to my friends who are even more beginners than me.

jean-michel.houbre
Автор

Wow. I didn't even know about changing the order of the sorting layers. I always kept everything on default and modified the order in layer. Awesome! Thank you for sharing, Code Monkey! As always, every time I watch something from you I learn something I didn't know.

subliminalcastillo
Автор

There is also the option to sort by y-axis for example, using Project Settings: Edit/Project Settings.../Transparency Sort Mode -> Custom and Transparency Sort Axis -> y=1

Kaikaku
Автор

I'm loving your course. Only good one that isnt $200. Please consider making more. I know they take a lot of time but they really help

eoin
Автор

There's a component too that can be added to GameObjects called sort group. Useful to modify the sorting order of an entire gameObject with many components on it. Great video as always.

dspartan
Автор

Thank you Sir! I saw this course in Udemy. I will watch it after my current card game project finishes. :D

stackflow
Автор

thanks, this really helped me fix a small issue in my 2D game :D

DeadlyInsaan
Автор

Keep up the good work, it helps us very much

sahilsharma
Автор

I was losing my mind. Then I saw your bit about setting world space. Thank god.

estogaza
Автор

Hi, thanks for the clearification. I am having some issues with sorting layers: i use a canvas and 2d lights with URP i managed to get the lights to show but they are always on top of everything no matter which sorting layer they are on. is there a way to render the 2d lights behind sprites placed in the canvas? thanks

Hiedalle
Автор

I am having an issue where I cannot change the order number when the animation is turned on.
It might be resetting to 0 very quickly, but not sure why this would happen when the animation is on. If it's off I can change it no problem.
Does anyone know if there is a setting that controls this?

NANA-btws
Автор

32, 768 is a positive integer equal to \(2^{15} = 2^{2^4 - 1}\). It is notable in computer science for being the absolute value of the maximum negative value of a 16-bit signed integer, which spans the range [-32768, 32767].

katiescape
Автор

How to bring your sprite to front on a layer with a click mouse?
Please 🙏 (Drag and drop system)

lora
Автор

Worth mentioning that the number of sort layers used by a 2D light does affect performance.. in addition, if the lit layers are not contiguous (background: lit, default: not lit, forgeound: lit), this will also negatively impact performance. According to unity, 2D lit layers should be contiguous whenever possible.

uncleswell
Автор

I have a panel object that I want to place so that it always appears behind my window which is a sprite, but also behind my UI text objects. Somehow, the Z coordinates of my text object influences that of the panel, so I can never place them correctly. How could I solve this issue ?

EDIT: Okay I solved :D ! The problem was that my panel had an Anchor Preset (The square on the left side of the Rect Transform component) that was a strech (the blue arrows). I changed the anchor preset to "middle" (the yellow dot with red lines), and I was able to deform it to the shape I want, with no overlaping :D !

bloomyfractal
Автор

Monkey please show us how to order 2D and 3D objects. I want to make a sprite appear in front of a 3d model. It seems very difficult

foreignwarren
Автор

What about conditional sorting? If I have this style of a top down 2d game and I have two objects on the same sorting layer, how can I set it up so that whichever object is lower on screen will show above the item that is above it? For moving objects that might change position, how could I set this up so the lower (on screen) object is always shown above the higher up object?

davidcalderwood