Last active
August 5, 2018 23:59
-
-
Save Demkeys/bef8516ea7b15282fda706bd462672e2 to your computer and use it in GitHub Desktop.
Simple example showing how to use the Screencapture class.
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
/// <summary> | |
/// Attach this script to any gameobject in the scene, enter Play Mode, then hit Space on your keyboard to capture a screenshot. | |
/// Exit Play Mode, refresh the Project panel, and the scenecap image should be in the Assets folder. | |
/// </summary> | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class ScreencapScript : MonoBehaviour { | |
// Use this for initialization | |
void Start () { | |
} | |
// Update is called once per frame | |
void Update () { | |
if(Input.GetKeyDown(KeyCode.Space)) | |
{ | |
ScreenCapture.CaptureScreenshot(Application.dataPath + "/screencap.png"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment