GetAdditionalLightsCount does not return correct number in Build, is fine during in editor

Hi,

I use the function “GetAdditionalLightsCount” to get the spot light count for my shader, for some reason this works ok in editor, but in build seems to not return or return wrong number.

I have added the pragmas to include the extra lights and shadows in the shader and when i hardcode the number in the shader i get the light correctly in the build, but if i use the GetAdditionalLightsCount number the light does not show up.

Is this a known bug ?

Thanks in advance

I’ve also run into this issue with URP 10.3.2 and it almost broke me. There’s a spotlight in the scene and “GetAdditionalLightsCount” apparently returns 0 in the build, 1 in the editor. Spent hours upon hours staring blankly at the frame debugger and trying to sample the shadowmap ten different ways.

2 Likes