Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug URP NullReference Error on SetRenderTarget

Discussion in '2022.1 Beta' started by castor76, Dec 20, 2021.

  1. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,426
    When upgrading project from 2021.2 to 2022.1, URP consistently spawns error on internal function for SetRenderTarget.

    Reported case : ( 1389780 )

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.Rendering.CoreUtils.SetRenderTarget (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle buffer, UnityEngine.Rendering.RenderBufferLoadAction loadAction, UnityEngine.Rendering.RenderBufferStoreAction storeAction, UnityEngine.Rendering.ClearFlag clearFlag, UnityEngine.Color clearColor, System.Int32 miplevel, UnityEngine.CubemapFace cubemapFace, System.Int32 depthSlice) (at Library/PackageCache/com.unity.render-pipelines.core@13.1.3/Runtime/Utilities/CoreUtils.cs:691)
    UnityEngine.Rendering.Universal.RenderingUtils.Blit (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle source, UnityEngine.Rendering.RTHandle destination, UnityEngine.Material material, System.Int32 passIndex, System.Boolean useDrawProcedural, UnityEngine.Rendering.RenderBufferLoadAction colorLoadAction, UnityEngine.Rendering.RenderBufferStoreAction colorStoreAction, UnityEngine.Rendering.RenderBufferLoadAction depthLoadAction, UnityEngine.Rendering.RenderBufferStoreAction depthStoreAction) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/RenderingUtils.cs:232)
    UnityEngine.Rendering.Universal.Render2DLightingPass.CopyCameraSortingLayerRenderTexture (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData renderingData, UnityEngine.Rendering.RenderBufferStoreAction mainTargetStoreAction) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/2D/Passes/Render2DLightingPass.cs:85)
    UnityEngine.Rendering.Universal.Render2DLightingPass.DrawLayerBatches (UnityEngine.Rendering.Universal.LayerBatch[] layerBatches, System.Int32 batchCount, System.Int32 startIndex, UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData, UnityEngine.Rendering.FilteringSettings& filterSettings, UnityEngine.Rendering.DrawingSettings& normalsDrawSettings, UnityEngine.Rendering.DrawingSettings& drawSettings, UnityEngine.RenderTextureDescriptor& desc) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/2D/Passes/Render2DLightingPass.cs:297)
    UnityEngine.Rendering.Universal.Render2DLightingPass.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/2D/Passes/Render2DLightingPass.cs:385)
    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@13.1.3/Runtime/ScriptableRenderer.cs:1089)
    UnityEngine.Rendering.Universal.ScriptableRenderer.ExecuteBlock (System.Int32 blockIndex, UnityEngine.Rendering.Universal.ScriptableRenderer+RenderBlocks& renderBlocks, UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData, System.Boolean submit) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/ScriptableRenderer.cs:1048)
    UnityEngine.Rendering.Universal.ScriptableRenderer.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/ScriptableRenderer.cs:821)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.CameraData cameraData, System.Boolean anyPostProcessingEnabled) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/UniversalRenderPipeline.cs:431)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera baseCamera) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/UniversalRenderPipeline.cs:579)
    UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.3/Runtime/UniversalRenderPipeline.cs:278)
    UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <60a316878f2f47b5ad8b2d4c8c6c52c0>:0)
    UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, System.Collections.Generic.List`1[T] renderRequests, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <60a316878f2f47b5ad8b2d4c8c6c52c0>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)


    My URP rendering setting seems to be ok, looking at the rendering assets from 2021.2 and 2022.1 versions, they look the same and ok to me.

    This error actually makes the rendering not work at all. ( no game screen shown )

    There is little to no information on how to work around this or what the problem is, because it used to just work for me 2021.2