How do I freeze the camera frame?

In certain scenarios in my game, I’d like to freeze the camera and stop all rendering but still show the last rendered frame.

The answer was pretty simple and intuitive but had some intuitive quirks. To freeze the camera, I had to set both the clear flags and culling mask to nothing so that the last rendering wouldn’t be cleared and nothing new would be rendered. I couldn’t set both on the same frame however, as the camera apparently needs time to render with the new settings so a coroutine did the trick:

IEnumerator FreezeCam()
{
        //yield return null;
	Camera.main.clearFlags = CameraClearFlags.Nothing;
	yield return null;
	Camera.main.cullingMask = 0;
}

I had a black screen on iOS metal with the ClearFlags approach. I managed to get it working with a temporary render texture. Attach this to your main camera doing the rendering. Then you just set the pause value, and celebrate.

public class CameraPause : MonoBehaviour
{
    [SerializeField] private RenderTexture _cachedRenderTexture;
    public bool paused;

    public static CameraPause instance;

    private void Awake()
    {
        instance = this;
    }

    void OnRenderImage(RenderTexture src, RenderTexture dest)
    {
        if (_cachedRenderTexture == null)
        {
            _cachedRenderTexture = new RenderTexture(src.width, src.height, src.depth);
        }

        if (paused)
        {
            Graphics.Blit(_cachedRenderTexture, dest);
        }
        else
        {
            Graphics.CopyTexture(src, _cachedRenderTexture);
            Graphics.Blit(src, dest);
        }
    }
}

Pro

Application.CaptureScreenshot and Graphics.Blit

Non-Pro

Application.CaptureScreenshot and the method Camera.OnRenderImage

forget about the source and just stuff your screenshot texture as the destination parameter or forget about capturing a screenshot and use the source texture in OnRenderImage method, stuff that in some variable for current and future use, apply that as the destination until freeze frame has elapsed.

Either Pro or Free:

Screenshot
Create a quad put it as a child to the camera, but ensure it’s properly distanced and all that jazz.
Enable Quad, put screenshot on quad.

Profit.