Facebook
From One Wheel Studio, 3 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 118
  1.     using UnityEngine;
  2.  
  3.     public class Screenshot : MonoBehaviour
  4.     {
  5.         [SerializeField]
  6.         private string path;
  7.         [SerializeField]
  8.         [Range(1, 5)]
  9.         private int size = 1;
  10.  
  11.         // Update is called once per frame
  12.         void Update()
  13.         {
  14.             if (Input.GetKeyDown(KeyCode.K))
  15.             {
  16.                 path += "screenshot ";
  17.                 path += System.Guid.NewGuid().ToString() + ".png";
  18.  
  19.                 ScreenCapture.CaptureScreenshot(path, size);
  20.             }
  21.         }
  22.     }
  23.  
  24.