Skip to content

Commit f25005d

Browse files
committed
Screenshot: Add screenshot utility
1 parent f56fcf8 commit f25005d

File tree

5 files changed

+91
-2
lines changed

5 files changed

+91
-2
lines changed

Editor/Screenshot/Screenshot.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using UnityEditor;
5+
6+
namespace UnityUtils.AnimatorControllerMerger
7+
{
8+
public static class Screenshot
9+
{
10+
[MenuItem("Tools/Unity Utils/Capture Game View/Camera Resolution")]
11+
public static void Screenshot1X() => TakeScreenshot(1);
12+
[MenuItem("Tools/Unity Utils/Capture Game View/Camera Resolution x2")]
13+
public static void Screenshot2X() => TakeScreenshot(2);
14+
[MenuItem("Tools/Unity Utils/Capture Game View/Camera Resolution x4")]
15+
public static void Screenshot4X() => TakeScreenshot(4);
16+
[MenuItem("Tools/Unity Utils/Capture Game View/Camera Resolution x8")]
17+
public static void Screenshot8X() => TakeScreenshot(8);
18+
19+
public static void TakeScreenshot(int superSize)
20+
{
21+
var path = EditorUtility.SaveFilePanel(
22+
"Save screenshot",
23+
"",
24+
"screenshot.png",
25+
"png");
26+
27+
if (path.Length != 0)
28+
{
29+
ScreenCapture.CaptureScreenshot(path, superSize);
30+
}
31+
}
32+
}
33+
}

Editor/Screenshot/Screenshot.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!84 &8400000
4+
RenderTexture:
5+
m_ObjectHideFlags: 0
6+
m_CorrespondingSourceObject: {fileID: 0}
7+
m_PrefabInstance: {fileID: 0}
8+
m_PrefabAsset: {fileID: 0}
9+
m_Name: Screenshot
10+
m_ImageContentsHash:
11+
serializedVersion: 2
12+
Hash: 00000000000000000000000000000000
13+
m_ForcedFallbackFormat: 4
14+
m_DownscaleFallback: 0
15+
serializedVersion: 3
16+
m_Width: 256
17+
m_Height: 256
18+
m_AntiAliasing: 1
19+
m_MipCount: -1
20+
m_DepthFormat: 2
21+
m_ColorFormat: 8
22+
m_MipMap: 0
23+
m_GenerateMips: 1
24+
m_SRGB: 0
25+
m_UseDynamicScale: 0
26+
m_BindMS: 0
27+
m_EnableCompatibleFormat: 1
28+
m_TextureSettings:
29+
serializedVersion: 2
30+
m_FilterMode: 1
31+
m_Aniso: 0
32+
m_MipBias: 0
33+
m_WrapU: 1
34+
m_WrapV: 1
35+
m_WrapW: 1
36+
m_Dimension: 2
37+
m_VolumeDepth: 1

Editor/Screenshot/Screenshot.renderTexture.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name" : "ga.roli.unity-utils",
33
"displayName" : "Unity Utils",
4-
"version" : "1.3.1",
4+
"version" : "1.4.0",
55
"author": {
66
"name": "Roliga",
77
"url": "https://roli.ga/"
@@ -12,4 +12,4 @@
1212
"legacyFolders" : {
1313
"Assets\\Unity Utils" : "ab7422ecfd69cc243ac3b0e03b1ad360"
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)