38 lines
791 B
C#
38 lines
791 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using System;
|
|
|
|
public class Screenshot : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
//StartCoroutine(TakeScreenshot());
|
|
|
|
/* if (Input.GetKeyDown(KeyCode.P))
|
|
{
|
|
StartCoroutine(TakeScreenshot());
|
|
}
|
|
*/
|
|
}
|
|
|
|
public void OnClickTakeScreenshot()
|
|
{
|
|
StartCoroutine(TakeScreenshot());
|
|
}
|
|
|
|
IEnumerator TakeScreenshot()
|
|
{
|
|
yield return new WaitForEndOfFrame();
|
|
string timpStamp = DateTime.Now.ToString("ddMMyyyyHHmmssffff");
|
|
ScreenCapture.CaptureScreenshot("snapshot_" + timpStamp + ".png");
|
|
}
|
|
}
|