NullReferenceException in HDAdditionalLightData

We’re getting following error (exclusively in the build, not in the editor):

Exception: NullReferenceException: Object reference not set to an instance of an object.

UnityEngine.Bindings.ThrowHelper.ThrowNullReferenceException (System.Object obj) (at C:/build/output/unity/unity/Runtime/Export/Scripting/BindingsHelpers.cs:62)
UnityEngine.Component.get_gameObject () (at <f77941c024d04bf08b352feebaaa1d91>:0)
UnityEngine.Component.TryGetComponent[T] (T& component) (at C:/build/output/unity/unity/Runtime/Export/Scripting/Component.bindings.cs:58)
UnityEngine.Rendering.HighDefinition.HDAdditionalLightData.get_legacyLight () (at ./Library/PackageCache/com.unity.render-pipelines.high-definition@16.0.4/Runtime/Lighting/Light/HDAdditionalLightData.cs:2182)
UnityEngine.Rendering.HighDefinition.HDAdditionalLightData.TickLateUpdate () (at ./Library/PackageCache/com.unity.render-pipelines.high-definition@16.0.4/Runtime/Lighting/Light/HDAdditionalLightData.cs:2666)
UnityEngine.Rendering.HighDefinition.LightLateUpdate.Tick () (at ./Library/PackageCache/com.unity.render-pipelines.high-definition@16.0.4/Runtime/Lighting/Light/HDAdditionalLightData.cs:3883)

I checked, the component is only on gameObjects that have Light component, so no idea why we’re overloaded with these errors. It seems as if it’s unable to retrieve the gameObject the script is on, not sure why/how.

Hey, thanks for reporting the issue here. It looks like an issue. If you have the time, the best thing to help would be to report something using unity bug reporter.

Hey. Thanks for response. We’ve upgraded to newer version of Unity 2023.2 and it seemingly went away. No idea why we were using so old version of it, tbh. Case closed for us.

1 Like