Hello,
I have a problem that is driving me crazy , I searched literature about it but it seems no one gives to the solution , some say even that may be a bug in this version of Unity . The problem is that when I try to take a screenshot I obtain always an offset image. I used this code:
public IEnumerator CaptureCamera()
{
isProcessing = true;
// wait for graphics to render
yield return new WaitForEndOfFrame();
// create the texture
Texture2D screenTexture = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, true);
// put buffer into texture
screenTexture.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0);
// apply
screenTexture.Apply();
dataToSave = screenTexture.EncodeToPNG();
destination = Path.Combine(Application.persistentDataPath, System.DateTime.Now.ToString("yyyy-MM-dd-HHmmss") + ".png");
File.WriteAllBytes(destination, dataToSave);
isProcessing = false;
}
this the original img:
and this is the result:
My Unity version is 5.2.2f1 Personal
Please someone knows the solution to this problem?
Thanks in advance