Skip to content

Instantly share code, notes, and snippets.

@murapong
Created January 30, 2016 16:12
Show Gist options
  • Save murapong/c330fb0d7d652baffd52 to your computer and use it in GitHub Desktop.
Save murapong/c330fb0d7d652baffd52 to your computer and use it in GitHub Desktop.
UnityでスクリーンショットをTexture2D形式で取得する
Texture2D CaptureScreenshot()
{
Texture2D texture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, true);
texture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0, true);
texture.Apply();
return texture;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment