Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Screenshotter : MonoBehaviour {
- [Header("Ctrl+")]
- public KeyCode ScreenshotButton;
- [Range(0,10)]
- public int SuperScreenMultiplier;
- [Header("read only")]
- public Vector2 screenshotResolution;
- void Awake(){
- if (ScreenshotButton == null)
- ScreenshotButton = KeyCode.Space;
- }
- // Update is called once per frame
- void Update () {
- screenshotResolution = new Vector2( Camera.main.pixelRect.width * SuperScreenMultiplier, Camera.main.pixelRect.height * SuperScreenMultiplier);
- if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(ScreenshotButton) )
- {
- System.DateTime time = System.DateTime.Now;
- string path = Application.productName +"_"+time.Minute+"_"+time.Second+".png";
- Debug.Log ("Screenshot captured! " + path);
- Application.CaptureScreenshot (path, SuperScreenMultiplier);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement