Search Unity

Exception when trying to set non-zero Shadow Intensity

Discussion in '2D Experimental Preview' started by Cerzi, Oct 4, 2019.

  1. Cerzi

    Cerzi

    Joined:
    Dec 28, 2014
    Posts:
    7
    edit - fixed by re-creating the pipeline assets

    Trying to test out the Shadow Caster 2D but having problems

    Started an empty scene, created two sprite renderes and a Light2D. Added a shadow caster to one sprite renderer and positioned so that the light should cast a shadow onto the other. However when I move the shadow intensity slider up from 0 I am spammed with this exception

    Full exception (editor mode)
    ```
    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Experimental.Rendering.Universal.RendererLighting.GetShadowMaterial (System.Int32 index) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/2D/Passes/Utility/RendererLighting.cs:591)
    UnityEngine.Experimental.Rendering.Universal.RendererLighting.RenderShadows (UnityEngine.Rendering.CommandBuffer cmdBuffer, System.Int32 layerToRender, UnityEngine.Experimental.Rendering.Universal.Light2D light, System.Single shadowIntensity, UnityEngine.Rendering.RenderTargetIdentifier renderTexture) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/2D/Passes/Utility/RendererLighting.cs:155)
    UnityEngine.Experimental.Rendering.Universal.RendererLighting.RenderLightSet (UnityEngine.Camera camera, System.Int32 blendStyleIndex, UnityEngine.Rendering.CommandBuffer cmdBuffer, System.Int32 layerToRender, UnityEngine.Rendering.RenderTargetIdentifier renderTexture, System.Collections.Generic.List`1[T] lights) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/2D/Passes/Utility/RendererLighting.cs:241)
    UnityEngine.Experimental.Rendering.Universal.RendererLighting.RenderLights (UnityEngine.Camera camera, UnityEngine.Rendering.CommandBuffer cmdBuffer, System.Int32 layerToRender) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/2D/Passes/Utility/RendererLighting.cs:476)
    UnityEngine.Experimental.Rendering.Universal.Render2DLightingPass.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/2D/Passes/Render2DLightingPass.cs:85)
    UnityEngine.Rendering.Universal.ScriptableRenderer.ExecuteRenderPass (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.ScriptableRenderPass renderPass, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/ScriptableRenderer.cs:412)
    UnityEngine.Rendering.Universal.ScriptableRenderer.ExecuteBlock (System.Int32 blockIndex, Unity.Collections.NativeArray`1[T] blockRanges, UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData, System.Boolean submit) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/ScriptableRenderer.cs:356)
    UnityEngine.Rendering.Universal.ScriptableRenderer.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/ScriptableRenderer.cs:246)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/UniversalRenderPipeline.cs:228)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, UnityEngine.Camera[] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@7.1.2/Runtime/UniversalRenderPipeline.cs:179)
    UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera[] cameras) (at <5e35e4589c1948aa8af5b8e64eea8798>:0)
    UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, UnityEngine.Camera[] cameras, System.IntPtr loopPtr, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <5e35e4589c1948aa8af5b8e64eea8798>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    ```
     
    Last edited: Oct 4, 2019
  2. Enixus

    Enixus

    Joined:
    Jul 13, 2019
    Posts:
    5
    I'm getting this exception, too...Have you found a solution?