I just installed Universal Render Pipeline into my 2D project and believe I have everything configured correctly.
- I created a new RenderPipeline asset
- I deleted the default Renderer on it and added a new 2D Renderer
- I added the RenderPipeline into the Graphics section of my Project Settings
- I changed all my sprites’ material from
Here is how everything is set up:
In fact, I can see results in my scene when I add lights to my objects. For example, here I have a
PointLight2D set to a
SortingLayer called “Enemy”. You can see that it properly lights the enemy sprite which is also set to that
The problem is that even with no other lights in the scene, if you toggle the
TargetSortingLayers to “None” (or simply some other
SortingLayer that doesn’t include “Enemy”), the enemy sprite in the scene still appears fully lit, which seems very odd. For example,
If, on the other hand, you simply disable the light, you see fully unlit sprites, which is what you’d expect.
So my question is why does setting a light’s
TargetSortingLayers to “None” (or simply a different layer than your sprite) not result in a fully unlit sprite, but rather a fully lit sprite?
I am wondering whether it is simply intentional behavior that I don’t understand, or possibly a bug in URP.
This behavior is reproducible in a brand new 2D project that you download the Universal Render Pipeline into with both
GlobalLight (haven’t tried other types of lights).
Related questions from elsewhere on the web, with no resolution:
- URP 2D lights not working as expected