I am using Deferred Rendering for URP Unity 2021.20b5 and I keep getting this weird behaviour with the lights in my scene. They flicker on\off depending on where the player is in the scene.
If I drag new lights into the scene once in play mode , those new lights don’t have this flicker behaviour - which makes me think its not a issue with the light limit.
It seems to only happen to the lights that are spawned in with the Map prefab.
Another note - we did have the lighting working in unity 2019 using Built in render pipeline and recently update.
Any help or advice would be incredibly helpful - we have tried solutions by tweaking URP asset, project setting , camera settings and many others but have hit a dead end!
Have the same issues (0b4). It worked fine, but flickering appeared after I’ve added a cookie to one of the lights. I’ve filed a bug report, but it has not been processed yet.
2021.3.3 f1 Same issues. If [Disable] the Additional Lights in URP Asset > Lighting, flickering is gone. I think it’s definitely a bug. However, it is not a solution because we have a custom shader that uses additional lighting. Has it been resolved in other Unity versions? Or is there a solution?
Check that none of your lights have a cookie texture in the ‘missing’ state (rather than ‘none’ or an actual texture). I’ve seen this cause light popping that looked like a culling issue, and spent quite some time debugging the internals of shaders to track it down.
Also switch your inspector into debug mode, and check ‘use bounding sphere override’ isn’t turned on for the problem lights (could potentially set lights to cull incorrectly).
There’s definitely an issue that relates to light cookie data that can cause lights to disappear - but it looks like there’s more to it than missing textures.
When a light fails to render, it appears that those lights have a _CookieLightIndex of >=0 and _LIGHT_COOKIES enabled when the light shouldn’t have a cookie.
I think this happens when there are no lights rendering cookies, but for some reason LightCookieManager is failing to clear the contents of m_VisibleLightIndexToShaderDataIndex[ ]. But I’m not sure what gets it into this state and don’t have a particularly reproducable case
After struggling for weeks we finally fixed this with the Blank Cookie way!!! (It also works in Build.) We tried set Render Mode to Important before, but that didn’t work for us. Thank you soooo much!