Search Unity

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

Question GetBlitMaterial return null

Discussion in 'General Graphics' started by kzchan11, Dec 1, 2023.

  1. kzchan11

    kzchan11

    Joined:
    Jul 8, 2020
    Posts:
    1
    Why my
    Code (CSharp):
    1. parameters.blitMaterial = Blitter.GetBlitMaterial(TextureXR.useTexArray ? TextureDimension.Tex2DArray : TextureDimension.Tex2D, parameters.srcTexArraySlice >= 0);
    return null.
    Context:
    - Built-in render pipeline
    - parameters.srcTexArraySlice was set to -1
    - Error in runtime:
    Code (CSharp):
    1. CoreUtils.DrawFullScreen(cmd, parameters.blitMaterial, destination, BlitPropertyBlock, 0);
    give this error:
    ArgumentNullException: Value cannot be null. Parameter name: material
    which means parameters.blitMaterial is null.
    - The DrawFullScreen function in CoreUtils.cs:
    Code (CSharp):
    1. public static void DrawFullScreen(CommandBuffer commandBuffer, Material material,
    2.             RenderTargetIdentifier colorBuffer,
    3.             MaterialPropertyBlock properties = null, int shaderPassId = 0)
    4.         {
    5.             commandBuffer.SetRenderTarget(colorBuffer, 0, CubemapFace.Unknown, -1);
    6.             commandBuffer.DrawProcedural(Matrix4x4.identity, material, shaderPassId, MeshTopology.Triangles, 3, 1, properties);
    7.         }