Screenshot resolution using ScreenCapture

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:

  1. Can I capture screenshots using this method without need to build and install app?
  2. Do I need to do something to guarantee that this error doesn’t appear in build when using phones with different resolutions?

Quick update for anyone who may be interested.

As second error says, I was trying to capture screenshot without waiting for end of frame. I was aware of that but wasn’t sure if the waiting will solve the issue. Since I’ve found a way to wait till the end of frame (you may want to see my other question on this matter), I haven’t observed any of the above errors. I will update this question if the error will appear again.