//public Texture2D LoadTexture(string FilePath) //{ // Texture2D Tex2D; // byte[] FileData; // if (System.IO.File.Exists(FilePath)) // { // FileData = System.IO.File.ReadAllBytes(FilePath); // Tex2D = new Texture2D(resWidth * 3, resHeight * 3); // Create new "empty" texture // if (Tex2D.LoadImage(FileData)) // Load the imagedata into the texture (size is set automatically) // return Tex2D; // If data = readable -> return texture // } // return null; // Return null if load failed //} private IEnumerator TakeScreenshotAndSave() { takeHiResShot = true; _cm.ChangeCanvasState(CanvasManager.canvasState.offAll); yield return(new WaitForEndOfFrame()); Texture2D ss = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); ss.ReadPixels(new Rect(0, 0, Screen.width * 3, Screen.height * 3), 0, 0); ss.Apply(); _cm.ChangeCanvasState(CanvasManager.canvasState.onAll); animationWolf.DefauldAnimState(); // Save the screenshot to Gallery/Photos string name = string.Format("{0}_Capture{1}_{2}.png", Application.productName, "{0}", System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); Debug.Log("Permission result: " + NativeGallery.SaveImageToGallery(ss, "AR" + " Captures", name)); string filePath = Path.Combine(Application.temporaryCachePath, "shared img.png"); File.WriteAllBytes(filePath, ss.EncodeToPNG()); nativeShare = new NativeShare().AddFile(filePath); _cm.ChangeCanvasState(CanvasManager.canvasState.afterFoto, LoadNewSprite(ss)); takeHiResShot = false; }