when I CreateScreenshotUsingRenderTarget, it can always produce screenshots normally
But when I use CreateScreenshotAsync, sometimes it can be generated normally, but there is also a probability of exceptions as follows
I don’t understand why there are these differences, but in order to achieve functionality, I chose to use CreateScreenshotUsingRenderTarget for generation. However, I encountered a problem, which is that it cannot run properly on iOS because it uses offscreencanvas for generation. Older versions of iOS do not support offscreencanvas. Looking at the code where the error occurred, would it be better to include error capture in offscreencanvas initialization?
After I copy these changes in your PR to my local Babylon, this error was solved. But the image captured was all black. And it’s also only on the phone that not support OffscreenCanvas.
And I have tried both CreateScreenshotUsingRenderTargetAsync and CreateScreenshotAsync
Thanks for your answer. But I think it’s not a timing problem. I take a screenshot when I manually click the button. Even after waiting several minutes, it’s still not working. I also tried your code, adding setTimeout, not work…
I wonder if there are some changes about the screenshot function about the compatibility problem. And I missed them in my path for my local Babylon package.