JanVac91 Posted October 10, 2018 Share Posted October 10, 2018 Hello everyone! I'm trying to accomplish the following task: - When there is a change of state I want to take a screenshot of the canvas, show to the user while the state is changing. Now I read that I should use canvas.toDataURL to obtain the base64 encoded Image. I can't understand the steps to accomplish this task. 1) I save the URL with canvas.toDataURL(). 2) I should convert the base64 to an image right? 3) I should add the Image to the cache OR i Should do a load.image? 4) The operation should be async right? Because in my trying the debugger console is saying that the image hasn't been retrieved and I don't understand how I can make toDataURL (or the conversion from base64 to png) async because there are no methods. Thanks for the help! Link to comment Share on other sites More sharing options...
prob Posted October 10, 2018 Share Posted October 10, 2018 As there are no states anymore, and you can run multiple scenes simultaneously, I think your question may be moot. But, if you do want to capture an image of your current scene, you could do so with a RenderTexture. Link to comment Share on other sites More sharing options...
jorbascrumps Posted October 10, 2018 Share Posted October 10, 2018 RenderTexture is definitely the way to go. Checkout this labs example. Link to comment Share on other sites More sharing options...
JanVac91 Posted October 11, 2018 Author Share Posted October 11, 2018 Thank you so much for the answers! I think i'll rewrite our team engine to use scenes and not states. Thank you again and have a nice day! Link to comment Share on other sites More sharing options...
Recommended Posts