Created
July 22, 2023 10:50
-
-
Save JEuler/75eee87bfc53769b9254013181e8ec6d to your computer and use it in GitHub Desktop.
Unity Screenshooter
This file contains hidden or 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
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