Search Unity

Bug Render Texture Create Failed with Confusing Error Message and Inconsistent Behaviour

Discussion in 'General Graphics' started by Non808, May 6, 2023.

  1. Non808

    Non808

    Joined:
    Aug 29, 2022
    Posts:
    1
    Not sure where to put this, sorry if this is the wrong forum. I'm getting "RenderTexture.Create failed: colorFormat & depthStencilFormat cannot both be none." for a render texture with a Color Format of None but a set Depth Stencil Format.
    Capture1.PNG Capture2.PNG
    On macOS this error doesn't seem to matter as the render texture still works fine but on Windows the render texture does not work, though this could also be because of the shaders as they do not act consistently between the platforms.
     
  2. chrpetry

    chrpetry

    Joined:
    Mar 7, 2018
    Posts:
    65
    I get the same error and Unity 2022.1.24f crashes completely in my build application.
     
  3. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
  4. Whatever560

    Whatever560

    Joined:
    Jan 5, 2016
    Posts:
    519
    Documentation on 2021 LTS :
    graphicsFormat The color format of the render texture. You can set the color format to None to achieve depth-only rendering.

    Code (which actually create the same texture as in OP)
    depthRT = new RenderTexture (bufferSize, bufferSize, 32, RenderTextureFormat.Depth, RenderTextureReadWrite.Linear)

    Result :
    RenderTexture.Create failed: colorFormat & depthStencilFormat cannot both be none.

    Gotcha : why is the issue marked as duplicate without any link to the issue it duplicates ? Because right now it seems like a bug.