Skip to content

Commit

Permalink
Save screenshots to dedicated directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
yutokun committed Apr 6, 2019
1 parent cb88568 commit 46786b8
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ScreenshotCapturer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Reflection;
using System.IO;
using System.Reflection;
using UnityEditor;
using UnityEngine;

Expand Down Expand Up @@ -34,6 +35,7 @@ void Start()
var gvSize = prop.GetValue(gameView, new object[0]);
var gvSizeType = gvSize.GetType();

// TODO : Free Aspect モードだと解像度が反映されない
switch (resolution)
{
case Resolutions.OculusStoreScreenShot:
Expand All @@ -57,9 +59,15 @@ void Update()
// TODO : リニア色空間に対応していない(2018.2)
if (Input.GetKeyDown(KeyCode.Space))
{
var currentDir = Directory.GetParent(Application.dataPath).ToString();
const string ssDir = "ScreenShots";
Directory.CreateDirectory(Path.Combine(currentDir, ssDir));

var now = System.DateTime.Now.ToString().Replace("/", ".").Replace(":", ".");
var filename = "SS " + now + ".png";
ScreenCapture.CaptureScreenshot(filename);

var path = Path.Combine(currentDir, ssDir, filename);
ScreenCapture.CaptureScreenshot(path);
}
}
}

0 comments on commit 46786b8

Please sign in to comment.