Skip to content

Instantly share code, notes, and snippets.

@johnsoncodehk
Last active January 28, 2019 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnsoncodehk/b3fbd0765e9caef2a0d6ed1248ccc15a to your computer and use it in GitHub Desktop.
Save johnsoncodehk/b3fbd0765e9caef2a0d6ed1248ccc15a to your computer and use it in GitHub Desktop.
Unity capture screenshot to file
#if UNITY_EDITOR
using System;
using UnityEngine;
using UnityEditor;
public static class ScreenCaptureMenu {
[MenuItem("ScreenCapture/CaptureScreenshot")]
public static void Cap() {
string filename = Convert.ToInt32(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds).ToString() + ".png";
ScreenCapture.CaptureScreenshot(filename);
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment