Skip to content

Instantly share code, notes, and snippets.

@makochang
Last active October 7, 2021 11:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makochang/f49c20ab58173fa2f87463d934e2ca73 to your computer and use it in GitHub Desktop.
Save makochang/f49c20ab58173fa2f87463d934e2ca73 to your computer and use it in GitHub Desktop.
Unityスクリーンショットを撮る
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SS_Matsuda : MonoBehaviour
{
private void Update()
{
// スペースキーが押されたら
if (Input.GetKeyDown(KeyCode.Space))
{
// スクリーンショットを保存
CaptureScreenShot("C:\\Users\\student\\Documents\\ScreenShot.png");
}
}
// 画面全体のスクリーンショットを保存する
private void CaptureScreenShot(string filePath)
{
Debug.Log(filePath);
ScreenCapture.CaptureScreenshot(filePath);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment