Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Urp settings errors

Discussion in '2022.2 Beta' started by oretakemitsu, Jun 21, 2022.

  1. oretakemitsu

    oretakemitsu

    Joined:
    Dec 18, 2021
    Posts:
    6
    2022.2.0a17

    urp 14.0.3

    CASE IN-7907

    errors occurred if Opaque Texture enabled in pipeline settings:

    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.List`1[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.List`1[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):

    upload_2022-6-22_1-32-45.png

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

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

    btw my Materials is fine in the scene.

    upload_2022-6-22_1-39-40.png
     
    Last edited: Aug 24, 2022
    MrDizzle26 likes this.
  2. DEEnvironment

    DEEnvironment

    Joined:
    Dec 30, 2018
    Posts:
    437
    i also have a report for this problem still found in the latest a18
    case number IN-9379
     
    dacarrera likes this.
  3. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,548
    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:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Rendering;
    3. using UnityEngine.Rendering.Universal;
    4. [ExecuteAlways]
    5. public class URPOpaqueTextureToggler : MonoBehaviour
    6. {
    7.   private void Start()
    8.   {
    9.     UniversalRenderPipelineAsset urp = (UniversalRenderPipelineAsset)GraphicsSettings.currentRenderPipeline;
    10.     urp.supportsCameraOpaqueTexture = Application.isPlaying;
    11.     // Debug.Log(urp.name + " Opaque Texture " + (urp.supportsCameraOpaqueTexture ? "Enabled" : "Disabled"));
    12.   }
    13. }
     
    MrDizzle26 likes this.
  4. MrDizzle26

    MrDizzle26

    Joined:
    Feb 8, 2015
    Posts:
    36
    Also having this issue on 2022.2.0b3
     
  5. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    105
    Having this issue in 2022.2.10f, coming this call in a render pass:

    Code (CSharp):
    1. Blitter.BlitCameraTexture(cmd, _cameraColorTarget, _cameraColorTarget, _material, 0);
    I've checked and no arguments being passed are null.
     
  6. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    105
    upload_2023-3-14_17-52-40.png

    We do not have opaque texture enabled.
     
  7. ChebanovDD

    ChebanovDD

    Joined:
    Mar 27, 2022
    Posts:
    7
    Hi. Did you manage to solve the problem?
     
  8. rhys_vdw

    rhys_vdw

    Joined:
    Mar 9, 2012
    Posts:
    105
    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:

    Code (CSharp):
    1.     public override void Create() {
    2.       _renderPass = new OutlinePass();
    3.       _dummyHandle = RTHandles.Alloc(1, 1);
    4.     }
    5.  
    6. // ...
    7.  
    8.       _renderPass.Setup(renderer.cameraColorTargetHandle, _dummyHandle, _material, PassSettings.RenderPassEvent);
    9.  
    10. // ...
    11.  
    12.       public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData) {
    13.         if (_material == null || _cameraColorTarget == null) {
    14.           return;
    15.         }
    16.  
    17.         CommandBuffer cmd = CommandBufferPool.Get();
    18.         using (new ProfilingScope(cmd, m_ProfilingSampler)) {
    19.           // TODO: ideally, blit with source texture null. (This causes an error.)
    20.           // Instead, use a dummy RTHandle.
    21.           Blitter.BlitCameraTexture(cmd, _dummySourceHandle, _cameraColorTarget, _material, 0);
    22.         }
    23.         context.ExecuteCommandBuffer(cmd);
     
    StenCG likes this.
  9. CaptainJP

    CaptainJP

    Unity Technologies

    Joined:
    Mar 25, 2022
    Posts:
    1
    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;
     
    StenCG, Deleted User and adamgolden like this.
  10. StuwuStudio

    StuwuStudio

    Joined:
    Feb 4, 2015
    Posts:
    165
    How is this still an issue.
     
  11. omichi_kento

    omichi_kento

    Joined:
    Jun 3, 2019
    Posts:
    2
    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.
     
  12. StuwuStudio

    StuwuStudio

    Joined:
    Feb 4, 2015
    Posts:
    165
    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.
     
  13. MuYiii

    MuYiii

    Joined:
    Jun 29, 2023
    Posts:
    1
    Has this bug been resolved?
     
  14. lx38

    lx38

    Joined:
    Nov 21, 2018
    Posts:
    1
    Why hasn't this stupid bug been fixed !!!
     
  15. omichi_kento

    omichi_kento

    Joined:
    Jun 3, 2019
    Posts:
    2
  16. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    610
    It's the same issue; whenever I input anything into the search bar, it triggers this error. Report on Unity 2022.3.3f1 lts
     
  17. yunzhencai

    yunzhencai

    Joined:
    Aug 1, 2022
    Posts:
    4
    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.
     
  18. firdiar

    firdiar

    Joined:
    Aug 2, 2017
    Posts:
    22
    any update?
    putting this still giving me the error
    upload_2023-11-22_14-52-11.png
     
  19. firdiar

    firdiar

    Joined:
    Aug 2, 2017
    Posts:
    22
    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)`

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