14
13

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 5 years have passed since last update.

画面キャプチャを保存する方法

Posted at

unityで画面キャプチャを保存してソーシャルシェアしたい。なんてことがあるんじゃないかと思います。

public IEnumerator CaptureAndShare(string fileName)
{
	// ここでウィジェットを隠したり画面キャプチャの前処理

	// レイアウト設定のために1フレーム待つ
	return yield new WaitForEndOfFrame ();
	
	Application.CaptureScreenshot (fileName);

	// キャプチャを保存する処理として1フレーム待つ
	return yield new WaitForEndOfFrame ();

	// 保存先のpathを取得
	string path = Application.persistentDataPath + "/" + fileName;

	// ここでシェアなど
}

呼び出す側からは、

StartCoroutine(CaptureAndShare());

なんかを使ってコルーチンを使って呼び出します。

14
13
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
14
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?