いつもの機能
スペースキーでスクショ保存。
using UnityEngine; using System.Collections; using System.IO; public class Screenshot : MonoBehaviour { [SerializeField] KeyCode key = KeyCode.Space; void Update() { if (Input.GetKeyDown(key)) { Save(); } } public void Save() { Directory.CreateDirectory("Screenshot"); var now = System.DateTime.Now; string path = "Screenshot/ss" + now.ToString("yyMMddHHmmss") + now.Millisecond.ToString("D3") + ".png"; Application.CaptureScreenshot(path); Debug.Log("screenshot saved at " + path); } }