投稿者 tel | 2014年11月8日

Unityでスクリーンショットを保存する

エディタの実行中の画面のスクリーンショットをとって保存するスクリプトを書いた。


using UnityEngine;
using UnityEditor;
public class CaptureScreenshot : Editor
{
[MenuItem("Editor/Capture…")]
public static void Capture()
{
string path = EditorUtility.SaveFilePanel("Save Screenshot", Application.dataPath, "cap", "png");
if (!string.IsNullOrEmpty(path))
{
Application.CaptureScreenshot(path);
}
}
}

Editorディレクトリに置くと、メニューにEditor – Captureが出てくるのでスクリーンショットを保存したいタイミングでクリックする。

cap2

これで開発中の画面をすぐに保存できる。


コメントを残す

カテゴリー