Urp settings errors

2022.2.0a17

urp 14.0.3

CASE IN-7907

errors occurred if Opaque Texture enabled in pipeline settings:

8222718--1073931--upload_2022-6-22_1-26-52.png

ArgumentNullException: Value cannot be null.
Parameter name: value
UnityEngine.MaterialPropertyBlock.SetTexture (System.Int32 nameID, UnityEngine.Texture value) (at <9d8790cb07b5448489717b720a1ca024>:0)
UnityEngine.Rendering.Blitter.BlitTexture (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle source, UnityEngine.Vector4 scaleBias, UnityEngine.Material material, System.Int32 pass) (at Library/PackageCache/com.unity.render-pipelines.core@14.0.3/Runtime/Utilities/Blitter.cs:238)
UnityEngine.Rendering.Blitter.BlitCameraTexture (UnityEngine.Rendering.CommandBuffer cmd, UnityEngine.Rendering.RTHandle source, UnityEngine.Rendering.RTHandle destination, UnityEngine.Rendering.RenderBufferLoadAction loadAction, UnityEngine.Rendering.RenderBufferStoreAction storeAction, UnityEngine.Material material, System.Int32 pass) (at Library/PackageCache/com.unity.render-pipelines.core@14.0.3/Runtime/Utilities/Blitter.cs:361)
UnityEngine.Rendering.Universal.Internal.CopyColorPass.ExecutePass (UnityEngine.Rendering.Universal.Internal.CopyColorPass+PassData passData, UnityEngine.Rendering.RTHandle source, UnityEngine.Rendering.RTHandle destination, UnityEngine.Rendering.CommandBuffer& cmd, System.Boolean useDrawProceduralBlit) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/Passes/CopyColorPass.cs:179)
UnityEngine.Rendering.Universal.Internal.CopyColorPass.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/Passes/CopyColorPass.cs:149)
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@14.0.3/Runtime/ScriptableRenderer.cs:1405)
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@14.0.3/Runtime/ScriptableRenderer.cs:1370)
UnityEngine.Rendering.Universal.ScriptableRenderer.Execute (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Rendering.Universal.RenderingData& renderingData) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/ScriptableRenderer.cs:1153)
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@14.0.3/Runtime/UniversalRenderPipeline.cs:472)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderSingleCamera (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/UniversalRenderPipeline.cs:372)
UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@14.0.3/Runtime/UniversalRenderPipeline.cs:320) UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List1[T] cameras) (at <9d8790cb07b5448489717b720a1ca024>: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 <9d8790cb07b5448489717b720a1ca024>:0)
UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr, Boolean&)

I created materials with shadergraph.
Materials previewing has errors in Inspector (If I disabled OpaqueTexture in pipeline settings, nothing goes wrong):

I notice that theres the same errors if my cursor hovering over some labels in Inspector:

8222718--1073937--upload_2022-6-22_1-37-23.png

btw my Materials is fine in the scene.

8222718--1073940--upload_2022-6-22_1-39-40.png

1 Like

i also have a report for this problem still found in the latest a18
case number IN-9379

1 Like

Thanks for this tip - the same error (Blitter.cs line 238) has been spamming my console in 2022.2 and 2023.1 along with flickering in the Scene window, transparent things seemingly drawing over themselves random numbers of times and other weirdness - even in brand new projects with nothing but simple assets imported.

However, with Opaque texture disabled, I can select objects in the scene that have transparent materials without getting the errors (ā€œAssertion Failedā€ in GUIUtility:ProcessEvent and the Blitter.cs one).

Iā€™m doing this now to enable it for Play Mode/builds and disable it for Edit Modeā€¦ added to a GameObject in the Hierarchy:

using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
[ExecuteAlways]
public class URPOpaqueTextureToggler : MonoBehaviour
{
  private void Start()
  {
    UniversalRenderPipelineAsset urp = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline;
    urp.supportsCameraOpaqueTexture = Application.isPlaying;
    // Debug.Log(urp.name + " Opaque Texture " + (urp.supportsCameraOpaqueTexture ? "Enabled" : "Disabled"));
  }
}
1 Like

Also having this issue on 2022.2.0b3

Having this issue in 2022.2.10f, coming this call in a render pass:

Blitter.BlitCameraTexture(cmd, _cameraColorTarget, _cameraColorTarget, _material, 0);

Iā€™ve checked and no arguments being passed are null.

We do not have opaque texture enabled.

Hi. Did you manage to solve the problem?

Yes, for context our issue is that weā€™re using BlitCameraTexture with a material that has no source input, so the confusion arose from what to pass to the ā€œsourceā€ argument. If we were to pass null there would also be an error, so we canā€™t do that. We were passing in the same handle for both source and dest, which was fine on older versions of URP. So our tech artistā€™s solution was to create a dummy texture that we can use instead:

    public override void Create() {
      _renderPass = new OutlinePass();
      _dummyHandle = RTHandles.Alloc(1, 1);
    }

// ...

      _renderPass.Setup(renderer.cameraColorTargetHandle, _dummyHandle, _material, PassSettings.RenderPassEvent);

// ...

      public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) {
        if (_material == null || _cameraColorTarget == null) {
          return;
        }

        CommandBuffer cmd = CommandBufferPool.Get();
        using (new ProfilingScope(cmd, m_ProfilingSampler)) {
          // TODO: ideally, blit with source texture null. (This causes an error.)
          // Instead, use a dummy RTHandle.
          Blitter.BlitCameraTexture(cmd, _dummySourceHandle, _cameraColorTarget, _material, 0);
        }
        context.ExecuteCommandBuffer(cmd);
1 Like

My custom render feature was throwing that same error (on Blitter.BlitCamreaTexture) any time the editor tried to draw a preview - so it wasnā€™t a problem in builds or on full screen play mode, but it was pretty annoying to have to toggle off the render feature when working in edit mode.

Adding this to the start of the render featureā€™s Execute function fixed the issue for me:
if (renderingData.cameraData.isPreviewCamera) return;

3 Likes

How is this still an issue.

There are 2 Different issues going on this thread.

  1. The issue oretakemitsu has reported(ArgumentNullException error appears when you search object on hierarchy and refresh GameView with your render pipeline has OpaqueTexture on.)
  2. The issue with Blitter.BlitCamreaTexture usage.

2nd issue could be solved with what CaptainJP said above.
But the 1st issue is still a problem and not solved.

I wasnā€™t satisfied with CaptainJPā€™s solution. Itā€™s weird to have to manage an empty UAV for no reason. I wish we had CoreUtils.emptyUAV but as a handle instead, and already provided for us.

Has this bug been resolved?

Why hasnā€™t this stupid bug been fixed ļ¼ļ¼ļ¼

this is the issue tracker.
All we can is waitingā€¦

Itā€™s the same issue; whenever I input anything into the search bar, it triggers this error. Report on Unity 2022.3.3f1 lts

Same issue here, Iā€™m using 2022.3.8f1 urp render pipeline.

Errors are like:
ArgumentNullException: Value cannot be null.
Assertion failed
UnityEngine.Rendering.Blitter:BlitTexture (UnityEngine.Rendering.CommandBuffer,UnityEngine.Rendering.RTHandle,UnityEngine.Vector4,UnityEngine.Material,int)
KeepFrameFeature/DrawOldFramePass:Execute (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Rendering.Universal.RenderingData&) (at Assets/Samples/Universal RP/14.0.8/URP Package Samples/RendererFeatures/KeepFrame/KeepFrameFeature.cs:63)
UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

It happend when running a new project, with just simple blocks with gravity, these errors evoked and usually caused Unity to crash.

any update?
putting this still giving me the error

1 Like

this was works for me, so after i learn, itā€™s only happen when you targeting the pass before transparent.
from there reference FullScreenPassRendererFeature.cs it was using cameraData.renderer.GetCameraColorBackBuffer(cmd). but since GetCameraColorBackBuffer is internal only, so using this should works RTHandles.Alloc(1, 1)

9486679--1334851--upload_2023-11-22_15-9-3.png