Search Unity

Bug 2D Spot Light Normal Maps Always Reset to Disabled

Discussion in '2D' started by florianhanke, Feb 5, 2021.

  1. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    On 2021.1.0b4, when setting any Normal Maps option other than Disabled on a 2D Spot Light, Unity won't save the updated value. I can hit play and see how it looks, but when I exit play, it is reset to Disabled. (Even simply setting it won't change any files)

    Can anyone reproduce this?
     
    matejla1111 likes this.
  2. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    When I use the debug Inspector and switch on "Use Normal Maps", then the Normal Maps option stays on the selected option.
     
    Nyko64 likes this.
  3. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    Yes, just tested it on clean project and 2d light normal maps setting is reset to disabled on play (2021.1).
     
  4. jyri_unity604

    jyri_unity604

    Joined:
    Sep 30, 2019
    Posts:
    2
    I can confirm that the issue exists still in 2021.2.0a10.1508. It's very annoying (well, a showstopper for me), hopefully this will get fixed soon.
     
  5. YupiNawate

    YupiNawate

    Joined:
    Feb 17, 2021
    Posts:
    11
    Aaaaahm... I dunno if it is about a bug or not, but I found something at:

    C:\Program Files\Unity\Hub\Editor\2021.1.3f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.render-pipelines.universal\Runtime\2D\Light2D.cs


    There's a boolean serialized field that is set to false:

    [SerializeField] bool m_UseNormalMap = false; // This is now deprecated. Keep it here for backwards compatibility.


    And then, in Awake() we have this:

    if (!m_UseNormalMap && m_NormalMapQuality != NormalMapQuality.Disabled)
    m_NormalMapQuality = NormalMapQuality.Disabled;



    So we have that NormalMapQuality is always set to Disabled. As I said, I dunno if it is a bug, but I found no solution anywhere, no answers in forums and I needed this working, so I changed the initial value from false to true in the Light2D.cs file (I had to grant write permissions to do it), I started my project and I replaced all my spot 2d lights with new instances. Result: working.
     
    Nixaan likes this.
  6. PitaCuParizel

    PitaCuParizel

    Joined:
    Feb 25, 2017
    Posts:
    7
    I'm on 2021.1.2f1 and same thing is happening, tried doing Yupi's suggestion but to no avail. Any ideas?

    Edit: I've figured it out, you don't edit the file at the path written above, but inspect any Light2D -> 3 dots -> Edit Script and do it there, and it should work.
     
    Last edited: Apr 18, 2021
  7. YupiNawate

    YupiNawate

    Joined:
    Feb 17, 2021
    Posts:
    11
    Hi PitaCuParizel,

    I exactly did that: I edited the Light2D.cs file in such path. If your project is running under a different version, you have to replace the 2021.1.3f1 in the path for your version. Another thing to take into account is that I could not edit the script with the Visual Studio editor (even when I had granted permissions), but I managed to do it using notepad. Then you need to open the project, remove your Light2D and add them again (test it adding one new light before replacing them).

    If you have any doubt on this process, don't hesitate on asking me.

    Kind Regards.
     
  8. PitaCuParizel

    PitaCuParizel

    Joined:
    Feb 25, 2017
    Posts:
    7

    Yup, I used my version instead, even tried your 2021.1.3f1 version and did it there aswell, I used notepad++ with admin rights, checked it was changed but after changing nothing happened. However, doing what I said in the edit worked and all is good now. Thanks anyway!
     
  9. YupiNawate

    YupiNawate

    Joined:
    Feb 17, 2021
    Posts:
    11
    I had no results the first try either... then I thought that maybe replacing the lights (remove and add) after editing the CS file it would work, and it did it... anyway, I am happy it's working now for you. Enjoy!
     
  10. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    I instead commented out the related code in the Awake() and current lights work right away.

    Code (CSharp):
    1. //if (!m_UseNormalMap && m_NormalMapQuality != NormalMapQuality.Disabled)
    2. //m_NormalMapQuality = NormalMapQuality.Disabled;
     
  11. YupiNawate

    YupiNawate

    Joined:
    Feb 17, 2021
    Posts:
    11
    Yep, same result at the end... Althought your fix makes more sense.
     
  12. dikar771

    dikar771

    Joined:
    Oct 30, 2015
    Posts:
    19
    2021.1.6 - the bug still exists
     
  13. YupiNawate

    YupiNawate

    Joined:
    Feb 17, 2021
    Posts:
    11
    Yep. I am keeping my "tunned" version until they fix it... So good they contacted us in the forum saying the bug will be fixed on next version.
     
  14. Deleted User

    Deleted User

    Guest

    Got it too in 2021.1.6f1 and I quite don't see why we should edit the script manually to fix it. @rustum?
     
  15. happys1294

    happys1294

    Joined:
    May 21, 2020
    Posts:
    2
    2021.1.7f1 - still not working
     
  16. Deleted User

    Deleted User

    Guest

    It's working in 2021.2. :)
     
  17. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
  18. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Still not working on 2021.1.9
     
  19. jrockpsycho

    jrockpsycho

    Joined:
    Sep 18, 2020
    Posts:
    8
    I tried editing the script, but in unity it says:
    The package cache was invalidated and rebuilt because the following immutable asset(s) were unexpectedly altered:
    Packages/com.unity.render-pipelines.universal/Runtime/2D/Light2D.cs

    If you could help me out I would very much appreciate it. Thank you!
     
  20. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    After you get that message you edit it again once more and this time it will remain changed.
     
  21. jrockpsycho

    jrockpsycho

    Joined:
    Sep 18, 2020
    Posts:
    8
    You are correct, Thank you!!
     
  22. Deleted User

    Deleted User

    Guest

    The problem is fixed in URP 12.
     
  23. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    The problem has been for so long and we have no idea when URP 12 will be officially released. Not sure why it takes so long for it to get backported. If we even have idea on "when" it would help... But not knowing when it will happen feels like walking in the dark with no lights.

    I would say bug like this is "Critical" and makes the current 2D light system to be not usable all together so beats me to wonder about why this problem isn't communicated / updated more often from Unity.
     
    Nixaan likes this.
  24. Nixaan

    Nixaan

    Joined:
    May 30, 2013
    Posts:
    118
    From time to time (usually when changing packages, and of course when updating the project to a new Unity version) it may reset to original state and you will need to modify it again.
     
  25. jrockpsycho

    jrockpsycho

    Joined:
    Sep 18, 2020
    Posts:
    8
    Wait so if it is fixed in URP 12, how do I update my project to use that?
     
  26. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    Right now, you probably have to upgrade to 2021.2 alpha version of Unity.

    Which is why I think this situation is weird. 2021.2 and such big release only happens twice per year, and unless you would like to go into alpha beta mode, you have to wait at least whole half an year for critical bug like this to be fixed.

    I thought the reason why package was introduced at the first, was to avoid situation like this where things are tied to the major Unity version release, but introduce more frequent and robust update.. But for the URP, it seems like 11 is for 2021.1 and 12 is for 2021.2 etc...
     
    Last edited: Jun 11, 2021
  27. Deleted User

    Deleted User

    Guest

    Lurking-Ninja likes this.
  28. FYI: in previous Unity versions, where you do not yet have "Add package by name" menu point, select the "Add package from git URL" menu point and add this format: "
    <package accessor>@<version number>
    ". For example:
    com.unity.recorder@2.5.5
    will install the Recorder v2.5.5.
     
  29. Deleted User

    Deleted User

    Guest

    Crap, I didn't know that. Sigh. Thanks! :)

    Here the format should be "com.unity.render-pipelines.universal@12.0.0" then.
     
  30. jrockpsycho

    jrockpsycho

    Joined:
    Sep 18, 2020
    Posts:
    8
    Got this:
    [Package Manager Window] Cannot perform upm operation: Unable to add package [com.unity.render-pipelines.universal@12.0.0]:
    Package [com.unity.render-pipelines.universal@12.0.0] cannot be found [NotFound].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
     
  31. Deleted User

    Deleted User

    Guest

    That was expected but it was worth trying. :)
     
  32. thenadamgoes

    thenadamgoes

    Joined:
    Apr 26, 2019
    Posts:
    29
    Was this bug ever fixed? I've been ignoring normal maps in my game for awhile now hoping this will be fixed and make life easier.
     
  33. kennyy_

    kennyy_

    Unity Technologies

    Joined:
    Apr 7, 2021
    Posts:
    96
    Hi folks, this bug has been backported and fixed from 2021.1.14 and onwards.
     
    dikar771, Charlivi and castor76 like this.