Reputation: 5
My game lets you dress up your character. I would like to save off that image (but not the rest of the 800x600 screen) to a file. According to the help, I can use Application.CaptureScreen() to capture the full screen but how does one capture just one part of it?
Upvotes: 0
Views: 3946
Reputation: 3907
If you want full control over what area you want to screenshot, I would recommend setting up a new camera with a RenderTexture
. This will enable a more flexible way of controlling your composition for your screenshots. Like the Avatar Creator on Xbox360.
RenderTexture
ReadPixels
to read from the RenderTexture into a Texture2D
and save using EncodeToPNG
.http://docs.unity3d.com/Manual/class-RenderTexture.html
http://docs.unity3d.com/ScriptReference/Texture2D.EncodeToPNG.html
Upvotes: 3