Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

In 5.6 CommandBuffer seems to have broken for BuiltinRenderTextureType.CurrentActive

Discussion in 'Editor & General Support' started by headlessstudio, Apr 26, 2017.

  1. headlessstudio

    headlessstudio

    Joined:
    Feb 25, 2016
    Posts:
    83
    I've posted this before but there seems to be a lack of answers from the dev team so I'm posting here again.

    In previous Unity releases (pre 5.6), we used a simple CommandBuffer to capture screen contents at each frame, using something like this on Start.
    Code (csharp):
    1.  
    2. var buf = new CommandBuffer {name = BufferName};
    3. cam.AddCommandBuffer(CameraEvent.AfterEverything, buf)
    4. buf.Blit(BuiltinRenderTextureType.CurrentActive, ElementFrameBuffer);
    5.  
    This worked great and with a single time setup, we goted an updated RenderTexture (ElementFrameBuffer) each frame. Now it seems that RenderTexture.active when in Deferred rendering is always null, and this doesn't work any more. We know ways around this, like grabbing OnRenderImage, but isn't so clean as a CommandBuffer.
    So is this a bug, or now in deferred the active rendertexture is never set by default by unity, as in previous versions?

    Best regards,
    Daniel Santana
    Technical Director/Co-founder
    You can do it! VFX