Created
June 3, 2019 05:36
-
-
Save sassembla/aa1f020dc1f093bc584128b375e5ce28 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MenuItem("Window/TakeScreenshotWithCaptureScreenshotAsTexture")] | |
public static void Menu() | |
{ | |
var tex = ScreenCapture.CaptureScreenshotAsTexture(); | |
var jpgBytes = tex.EncodeToJPG(10);// 90KB | |
using (var sw = new StreamWriter("a.jpg")) | |
{ | |
sw.BaseStream.Write(jpgBytes, 0, jpgBytes.Length); | |
} | |
} |
NotValid
- Mac 2017.4.22
- Mac 2017.4.27
- Mac 2018.2.2f1
- Mac 2018.3.0f2(crash)
- Win 2018.3.6f1(crash)
- Mac 2018.3.11
- Mac 2019.1.1f1(crash)
- Mac 2019.1.0f2
Valid
- Win 2019.1.0f2
Mac でエディタごと落ちた。
- 2019.1.1f1
- 2018.3.0f2
Windows でも落ちた。
- 2018.3.6f1
エディタでそもそも読んではいけない系?
エディタでそもそも読んではいけない系?
ScreenCapture.CaptureScreenshot はEditorで読んでも動くんで、AsTextureだけちゃんと動かないのはバグではという感想っす。
@makoto-unity
Finally! you've got a perfect result! isn't it?
conclusion:
Unity Editor 2019.1.0f2 windows can take valid screenshot on Editor without playing.
Unity Editor 2019.1.2f1 mac also can take valid screenshot onEditor with playing.
limited: free aspect mode required.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
↑のコードをUnity Editorで実行してみてください(メニュー > Window > TakeScreenshotWithCaptureScreenshotAsTexture で実行できる)
んでプロジェクトフォルダに生成されたa.jpgを、Unityのバージョンと一緒にgistに書き込んでもらえると大変うれしい。
果たして正しく撮影できるUnity versionが存在するのか?