Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

2D Lighting Bug: Any light source defaults everything to be lit

Discussion in '2D Experimental Preview' started by diesoftgames, Jun 8, 2020.

  1. diesoftgames

    diesoftgames

    Joined:
    Nov 27, 2018
    Posts:
    90
    I'm not sure when this happened, and I tried going back to other versions of Unity, but couldn't pinpoint anything, but perhaps someone knows something about this bug. Here's what's happening in my project now:

    Say I have a project with sprites on two different sorting layers. I create a global light with intensity 1, but it's only targeting one of the two layers. BOTH layers will now be lit as if by a 1 intensity global light. Now if I reduce the intensity, the correct sorting layer sprite will have it's lighting reduced appropriately, but the other one, which the light should not even be affecting, will stay as if lit by a 1 intensity global light. If I drop it to 0, and then toggle the game object's active state, that is the only way I can get it to stop lighting layers it's not targeting.

    tldr; The presence of ANY 2D light causes unlit sprites to appear as if lit by a 1 intensity global light. This bug persists in edit and runtime. Any help with debugging what might be the source of this would be appreciated.
     
    abots and AzureMasters like this.
  2. elucard_

    elucard_

    Joined:
    Oct 30, 2019
    Posts:
    8
    Hey, did you fix this problem? I have the exact same thing. Any advice on this would be appreciated! :)
     
  3. diesoftgames

    diesoftgames

    Joined:
    Nov 27, 2018
    Posts:
    90
    I haven't found a fix, I've just worked around it.
     
  4. AzureMasters

    AzureMasters

    Joined:
    Dec 2, 2016
    Posts:
    3
    What was your workaround? I'm having this issue
     
  5. elucard_

    elucard_

    Joined:
    Oct 30, 2019
    Posts:
    8
    Create point light for every sorting layer and make the radius super high so it always affects every object or just parent it to your player and just set intensity to 0. It works for me
     
    AzureMasters likes this.
  6. Chris_Chu

    Chris_Chu

    Unity Technologies

    Joined:
    Apr 19, 2018
    Posts:
    229
    Can you file a bug report on this?
     
  7. elucard_

    elucard_

    Joined:
    Oct 30, 2019
    Posts:
    8
    Seems like he's not gonna reply. I will file a bug report on this. I have the same issue and it would be nice if you fix it
     
  8. elucard_

    elucard_

    Joined:
    Oct 30, 2019
    Posts:
    8
    Never mind, I have another bug. The "Report a Bug..." window won't open and I can't find it in the installation folder either. I guess I'll have to report this bug first. Wait... What exactly should I do now?
     
  9. diesoftgames

    diesoftgames

    Joined:
    Nov 27, 2018
    Posts:
    90
    Sorry any time I've tried to report a bug with the bug reporter that pops up I run into a world of hurt (maybe project size or something). I might have had a sample project that shows this bug but I don't anymore.
     
  10. abots

    abots

    Joined:
    Feb 22, 2022
    Posts:
    2
    Experiencing the same thing. Is there a fix already?
     
  11. abots

    abots

    Joined:
    Feb 22, 2022
    Posts:
    2
    Found a fix for this. You need to have a global light in ur scene that affects all sorting layers before adding other lights. If there's no global light, I think unity will automatically create one for u with an intensity of 1. But I don't think unity supports using multiple global lights each affecting different layers.
     
  12. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,813
    Yeah, that's pretty easy to reproduce:

    2cmKUnjS49.gif

    Unity 2020.3.26f1, URP 10.8.1
     
  13. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    5,813
    I wondered why I hadn't seen this bug before, but we're using a system where we automatically spawn a global light targeting all layers both in edit mode and play mode, so that prevents it :p
     
unityunity