I am trying to Take a screencapture and save it to a file in jpg format.
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);
var bytes = tex.EncodeToJPG();
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.