0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Unity】アプリ実行中に使用できるキャプチャ取得&読み込み方法

Last updated at Posted at 2022-06-07

はじめに

UnityEditorでスクリーンショットの撮影方法を調べるとUnityRecorderが沢山ヒットしますが、ビルド後にキャプチャすることはできないため、ビルド後も利用可能なスクリーンショットの取得方法を調べてみました。

2Dのキャプチャを取得してから読み込む方法

UnityEngine標準機能でキャプチャ

UnityEnginに含まれるScreenCapture.CaptureScreenshotを利用するとApplication.persistentDataPath内にpng形式で生成される。

pngファイルからTexture2Dに読み込む

Texture2DをSpriteに変換する

360°のキャプチャを取得してから読み込む方法

360°スクリーンショットの撮影(Unity標準機能では無理っぽい)

バイト配列まではコチラのリポジトリを利用する。
※Unity標準の機能では2Dしか撮影できない。

バイト配列をTexture2Dに変換する

Texture2DをSpriteに変換する

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?