private IEnumerator saveDrawing() { yield return(new WaitForEndOfFrame()); ApplicationFileManager.SavePaintTextureToAddGlyphFile(canvasTexture.GetScreenshot()); SceneManager.LoadScene(ADD_GLYPH_SCENE); }
IEnumerator TakeScreenShot() { // NOTE: this has to be called first, otherwise ReadPixels() fails inside GetScreenshot yield return(new WaitForEndOfFrame()); byte[] bytes = mobilePaint.GetScreenshot().EncodeToPNG(); //byte[] bytes = mobilePaint.GetCanvasAsTexture().EncodeToPNG(); // this works also, but only returns drawing layer string filename = "Screenshot.png"; // string folder = Application.persistentDataPath + "/Screenshots/"; // this works also string folder = Application.dataPath + "/Screenshots/"; string path = folder + filename; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } File.WriteAllBytes(path, bytes); Debug.Log("Screenshot saved at: " + path); }