Created
July 29, 2019 23:36
-
-
Save oismaelash/6126436bc1ea08f577b9116ba1a1403b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private IEnumerator Screenshot_Coroutine() | |
{ | |
yield return new WaitForEndOfFrame(); | |
Texture2D screenshot = ScreenCapture.CaptureScreenshotAsTexture(); | |
string screenshotBase64 = Convert.ToBase64String(screenshot.EncodeToPNG()); | |
var bytes = Convert.FromBase64String(screenshotBase64); | |
using (var imageScreenshot = new FileStream(PathFileScreenshot, FileMode.Create)) | |
{ | |
imageScreenshot.Write(bytes, 0, bytes.Length); | |
imageScreenshot.Flush(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment