2D Spot Light Normal Maps Always Reset to Disabled

,

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?

1 Like

When I use the debug Inspector and switch on “Use Normal Maps”, then the Normal Maps option stays on the selected option.

1 Like

Yes, just tested it on clean project and 2d light normal maps setting is reset to disabled on play (2021.1).

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.

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.

1 Like

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.

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.

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!

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!

I instead commented out the related code in the Awake() and current lights work right away.

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

Yep, same result at the end… Althought your fix makes more sense.

2021.1.6 - the bug still exists

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.

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

2021.1.7f1 - still not working

It’s working in 2021.2. :slight_smile:

If it is fixed depends on the version of URP that comes with Unity. It is fixed in URP 12 and bugged in URP 11. If I’m not mistaken they will push back the fix to 11 at some point.

Still not working on 2021.1.9

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!

After you get that message you edit it again once more and this time it will remain changed.