I need to take screenshot and hold it in memory so later I can serialise it in save file with all the other information I need to save. We’re using Unity 2019.3.0a8 and as documentation says for taking screenshots there is class ScreenCapture for which I wasn’t able to find any information except for Unity Scripting API. I tried to take screenshot and I’ve got following error:
CaptureScreenshot(L:0, B:0, W:1920, H:1080) requested a region that exceeds the active Render Target sized [W:1212, H:754].
CaptureScreenshotAsTexture() failed to generate texture! Was method called before the ‘end of frame’ state was reached?
I understand that it has something to do with the fact that I’m calling this from editor and not from built application run at phone, but I would like to find out a couple of things:
- Can I capture screenshots using this method without need to build and install app?
- Do I need to do something to guarantee that this error doesn’t appear in build when using phones with different resolutions?