- Home /
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 ?
Answer by phil_me_up · Jan 07, 2016 at 10:36 PM
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?
Going to test it out tomorrow, if it works I'm going to accept your answer ! :)
Well It was quite a while, but I didn't have time to have fun with it. Thanks for introducing me RenderTextures as I've never met them before, and it's AWESO$$anonymous$$E !
Your answer
![](https://koobas.hobune.stream/wayback/20220612055401im_/https://answers.unity.com/themes/thub/images/avi.jpg)