Hello!
Trying to learn more about rendering in Unity. I have already googled and read a lot of threads here and tried a lot of code during many evenings now, but it seems a lot of these threads are quite old, so I decided to try my luck and make a new one.
I’m on Unity 2022.3.
Anyway, I’m trying to have a camera render to a low resolution render texture after it has rendered whatever it sees to the screen. Or before, it doesn’t matter, I just want it to render to both the texture and the screen.
This is how I thought it should work; create a command buffer, blit from camera target to the render texture, and add the command to the camera. Unfortunately, this piece of code seems to do absolutely nothing at all, so I guess I’ve misunderstood how it should work. ![]()
using System;
using UnityEngine;
using UnityEngine.Rendering;
public class UiCamera : MonoBehaviour {
[SerializeField] private Camera cam;
[SerializeField] private RenderTexture rt;
private CommandBuffer cmdBuffer;
private void Update() {
cmdBuffer = CommandBufferPool.Get();
RenderTargetIdentifier rti = new RenderTargetIdentifier(rt);
cmdBuffer.Blit(BuiltinRenderTextureType.CameraTarget, rti);
cam.AddCommandBuffer(CameraEvent.AfterEverything, cmdBuffer);
}
}
I’m super thankful for any help. I’m currently going through Catlike Coding’s stuff on Custom SRP, but I was hoping it would be easy to just add another command to a camera and that I wouldn’t need a whole customized render pipeline.
Thanks for reading and have a nice day!



