Application.CaptureScreenshot() is not fast enough

Hey there !

I’m making a menu where I use a screenshot from the game whenever the player opens it. My problem is that Application.CaptureScreenshot() is not fast enough to capture the screenshot then load it immediately . My code looks like this:

Application.CaptureScreenshot("menu.png");
bgImage = LoadPNG("menu.png");	

If the two codes are after each other it only works after I try it twice, because the second time it loads the previous screenshot not the one which was made just before.

Any ideas how to work around ? Maybe do it in a coroutine ?

You could use a render texture to render the last camera view rather than having to actually capture the pixels, write them out to a file then read them back in?