Created
July 19, 2021 18:52
-
-
Save d12/a839e8d29dfd31b4bdc5097f96a4f75f to your computer and use it in GitHub Desktop.
Takes a super high res screenshot in Unity 2019.4 when you press G.
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
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEditor; | |
using UnityEngine; | |
public static class TakeScreenshot | |
{ | |
// See http://docs.unity3d.com/ScriptReference/MenuItem.html for docs on [MenuItem] hotkeys | |
[MenuItem("Helpers/Screenshot _g")] | |
public static void Screenshot() | |
{ | |
if (!Application.isPlaying) | |
{ | |
Debug.LogError("Cannot take a screenshot unless the game is playing."); | |
return; | |
} | |
string path = $"Screenshots/{System.Guid.NewGuid()}.png"; | |
ScreenCapture.CaptureScreenshot(path, 4); | |
Debug.Log($"Saved screenshot in {path}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment