We’ve encountered an issue in our project which causes both editor and builds to crash when light intensity on our directional light is changed (via script or moving intensity slider in inspector). We have a few point/spot lights and sun directional light shadow property set to OnDemand. Every few frames we’re updating shadows by calling Light.RequestShadowMapRendering() in LateUpdate() on each of those lights.
What we’ve noticed is that if sun’s shadow mode is set to every frame we cannot reproduce that, but as soon as we change that to OnDemand and wiggle intensity slider on that light for a bit, it crashes. It usualy happens when intensity is around 0. We could not reproduce that behawior on an empty scene.
This is the last log in log:
Light index must be a valid shadow casting light
UnityEngine.Debug:ExtractStackTraceNoAlloc (byte*,int,string)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.Rendering.ScriptableRenderContext:Submit ()
UnityEngine.Rendering.HighDefinition.HDRenderPipeline:Render (UnityEngine.Rendering.ScriptableRenderContext,System.Collections.Generic.List`1<UnityEngine.Camera>) (at ./Library/PackageCache/com.unity.render-pipelines.high-definition@2396b5072f5b/Runtime/RenderPipeline/HDRenderPipeline.cs:2474)
UnityEngine.Rendering.RenderPipeline:InternalRender (UnityEngine.Rendering.ScriptableRenderContext,System.Collections.Generic.List`1<UnityEngine.Camera>)
UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset,intptr,UnityEngine.Object,Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle)
UnityEditor.EditorGUIUtility:RenderPlayModeViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Vector2,bool,bool)
UnityEditor.PlayModeView:RenderView (UnityEngine.Vector2,bool)
UnityEditor.GameView:OnGUI ()
UnityEditor.HostView:InvokeOnGUI (UnityEngine.Rect)
UnityEditor.DockArea:DrawView (UnityEngine.Rect)
UnityEditor.DockArea:OldOnGUI ()
UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool)
UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool)
UnityEngine.UIElements.IMGUIContainer:DoIMGUIRepaint ()
UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams,single,System.Exception&)
UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain (UnityEngine.UIElements.UIR.RenderChainCommand,UnityEngine.Material,UnityEngine.Texture,UnityEngine.Texture,System.Nullable`1<UnityEngine.Rect>,single,bool,UnityEngine.UIElements.TextureSlotCount,bool,System.Exception&)
UnityEngine.UIElements.UIR.RenderTreeManager:RenderSingleTree (UnityEngine.UIElements.UIR.RenderTree,UnityEngine.RenderTexture,UnityEngine.RectInt,UnityEngine.Rect)
UnityEngine.UIElements.UIR.RenderTreeManager:RenderRootTree ()
UnityEngine.UIElements.UIRRepaintUpdater:Render ()
UnityEngine.UIElements.BaseVisualElementPanel:Render ()
UnityEngine.UIElements.Panel:Render ()
UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&)
UnityEngine.UIElements.UIEventRegistration:ProcessEvent (int,intptr)
UnityEngine.UIElements.UIEventRegistration/<>c:<.cctor>b__1_2 (int,intptr)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
[./Library/PackageCache/com.unity.render-pipelines.high-definition@2396b5072f5b/Runtime/RenderPipeline/HDRenderPipeline.cs line 2474]
We’re using HDRP 17.3.0 and Unity 6000.3.6f1
Are there any recommendation when it comes to handling light intensity and updating shadows, or has someone encountered similar issue?