This is what I have so far:
string jpgFile = Application.persistentDataPath + "/scrn-1.jpg";
Texture2D tex = new Texture2D (Screen.width, Screen.height);
tex.ReadPixels (new Rect(0, 0, Screen.width, Screen.height), 0, 0);
tex.Apply ();
var bytes = tex.EncodeToJPG();
Destroy (tex);
System.IO.File.WriteAllBytes(jpgFile, bytes);
I have found that running this in Unity on iOS gives me:
JPEG parameter struct mismatch: library thinks size is 372, caller expects 360
However if I change the conversion to tex.EncodeToPNG(); and change the file name to .png everything works fine. I am not sure how to proceed any assistance would be appreciated. Thanks.
marcel ethan
16-Oct-2014I found this, which lets you save it as .jpg. I normally just use capture screen and save as .png.
Here you go:
If you just want any kind of picture I highly recommend this: