If I’m not wrong, on 2D games, the sorting layer have preference over the z position for showing layers. After the sorting layer, the order in layer is the next more important value, and only after this one, the z position. Am I right?
Also, what’s the layers (not sorting layers) for?
Sorting Layers are how objects are seen by the camera. This becomes obvious when you remember that sorting layers are attached to the renderer. Therefore, sorting layers (and order in sorting layers) determine how objects are rendered in the scene.
Layer, up there next to tags, is for grouping objects. Maybe you have a bunch of objects that are similar in that they will be rendered differently from other objects. They would be on different layers. Or, if only certain objects are supposed to be collidable and some are not, they would be on different layers.
Sorting layers are visual.
Layers are functional.
if I’m not mistaken, the sorting layer is used for 2D games. You have the name of the sorting layer, and then the number below it. So say you have 2 enemies (bing and bong), and you want bing to be in front of bong. Well, then you would tag them with an “enemies” sorting layer, made by you (doesn’t have to be named enemies, it’s your choice), and you would put bing on sorting layer number 2, and bong on sorting layer number 1.
Other sorting layers can be made for things like the player and decorations. You would place those sorting layers in the appropriate orders.
The regular “Layer” tagging option up at the top is for collisions (for me). You would tag things with layers. Pretend you didn’t want bing and bong to touch, because they’re enemies. You would put them on the enemies layer, and ensure in edit>project>physics/physics2D that where the horizontal and vericle lines meet is unchecked for the enemy titles. The rest of the layers shows what the enemies will hit, unless unchecked in the respected column.
Sorting layer is used in 2D games. Sorting Layers are on sprites, which tell what order the camera should see the sprites in the seen. For instance, if the sorting later on one sprite is 10, and the sorting layer on another is 5, since 10 is greater than 5, the sprite with the sorting layer of 10 will appear on top / in front of the one with 5. Essentially, it’s changing the Z position of the sprite by just a tiny bit, enough to be in front of other sprites. It doesn’t actually change the Z position, but that’s the best way to describe sorting layer. Layers have to do with certain levels of detection. For instance, you can add one layer (which will be given an index and a name) to a certain object, and another layer to another object. Let’s say we have layer A and layer B. We can tell the camera to only render layer A and ignore layer B. Or, if we use raycasting, we can tell the raycast to ignore a certain layer it collides with.