Hi, I was wondering what should be proper the way to work with 2D unity lights and the sorting map, every tutorial I've seen about URP and 2D lights says I should use the sorting layers to make some objects be affected by lights, but I tried doing that with my project by moving the player to a new sorting layer (I want some of the lights not to affect the player) and that made the AC sorting map not to work properly anymore (by that I mean the player just walks on top of everything), I'm assuming that's because the player should be in the same sorting layer as the other objects following the sorting map. Am I doing something wrong? Or maybe there's a way to make the lights follow the sorting map as well in the default layer? I coudn't find a way to do that as the sorting order of my other objects is set in the sprite renderer and 2D lights aren't sprites (I added the follow sorting map component but nothing happened). Here's how it looks with everything in the same sorting layer (not what I want), here's how it should look (moving the player to another sorting layer, but the AC sorting map stops working properly), and here's some photos of the light's inspector and sorting layers.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
The Player would need to be in the same Sorting Layer as objects you want to be able to visually interact with (i.e. control one overlapping the other). That's true whether you use a Sorting Map, or instead your URP asset's Transparency Sort Mode, for sprite sorting - I'm not sure this is strictly an AC issue.
In the case of your example, the background itself could be on a separate Sorting Layer, because it's always going to be drawn underneath your Player (unless the Player can "go through" the doorway and be occluded behind the frame).
It's possible to alter a sprite's Layer at runtime through script - in more complex cases, I wonder if that would need to be an option.