Hey everybody,
I have a question regarding CommandBuffer.SetRenderTarget and how it interacts with ScriptableRenderPasses in URP. According to the official CommandBuffer.SetRenderTarget docs:
You do not explicitly need to preserve active render targets during command buffer execution (current render targets are saved & restored afterwards).
This behaviour is somehow not consistent with ScriptableRenderPasses. As an example: if I call SetRenderTarget in a CommandBuffer for ScriptableRenderPass that executes AfterRenderingOpaques, the RenderTarget is not restored afterwards and the skybox will be rendered to the wrong render target. If this is a bug, I can submit a bug report.
I tried searching for an answer for this behaviour, but didn’t find anything useful. Is this behaviour documented better somewhere? Can somebody from the Unity dev team explain what exactly is happening here.