Skip to content

Instantly share code, notes, and snippets.

@JEuler
Created July 22, 2023 10:50
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 JEuler/75eee87bfc53769b9254013181e8ec6d to your computer and use it in GitHub Desktop.
Save JEuler/75eee87bfc53769b9254013181e8ec6d to your computer and use it in GitHub Desktop.
Unity Screenshooter
public class ScreenShooter : MonoBehaviour {
private int _count = 0;
// Update is called once per frame
private void Update() {
if ( Input.GetKeyDown( KeyCode.S ) ) {
while ( System.IO.File.Exists( "ScreenShot_" + _count + "_" + Screen.width + "x" + Screen.height + ".png" ) ) {
_count++;
}
ScreenCapture.CaptureScreenshot( "ScreenShot_" + _count + "_" + Screen.width + "x" + Screen.height + ".png" );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment