Projext/Assets/BrokenVector/LowPolyDungeon/Demo Scenes/ScreenshotMaker.cs
2026-02-22 22:37:34 +09:00

31 lines
765 B
C#

using System.IO;
using UnityEngine;
#if UNITY_EDITOR
[ExecuteInEditMode]
public class ScreenshotMaker : MonoBehaviour
{
void Update()
{
if (Input.GetButtonDown("Submit"))
{
var dir = Directory.GetParent((Application.dataPath)).ToString();
int counter = 0;
while (true)
{
var path = Path.Combine(dir, $"Screenshot_{counter}.png");
if (File.Exists(path))
{
counter++;
}
else
{
ScreenCapture.CaptureScreenshot(path);
print($"Saved screenshot to {path}");
return;
}
}
}
}
}
#endif