I’m using Camera.Render() to take screenshots, and it causes native assert to fail, since I’m using half width / height for save file metadata. (Using fullsize is already a waste, and takes longer time, so idk)
“Dimensions of color surface does not match dimensions of depth surface”
So, how to avoid it? I’ve been searching web but haven’t found anything.
Would be great if anyone point me in the right direction. It’s sure harmless, but it writes to the disk as well with the logs.
Here’s what I’ve been using:
RenderTexture previousTarget = _camera.targetTexture;
RenderTexture rt = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGB32);
_camera.targetTexture = rt;
Texture2D screenShot = new Texture2D(width, height, TextureFormat, false);
_camera.Render();
RenderTexture.active = rt;
screenShot.ReadPixels(new Rect(0, 0, width, height), 0, 0);
_camera.targetTexture = previousTarget;
RenderTexture.active = null;
RenderTexture.ReleaseTemporary(rt);
Alternative is to attach a buffer and then blit the image to the texture, I guess?