I'm using ReadPixels to capture the screen, but the texture always comes out quite a bit offset from the top.
This is the code I'm using:
Texture2D tex2d = new Texture2D(Screen.width,Screen.height,TextureFormat.RGB24,false);
tex2d.ReadPixels(new Rect(0,0,Screen.width,Screen.height),0,0,false);
tex2d.Apply();
Here is what the Screen looks like:
![alt text][1]
And here is the result from ReadPixels:
![alt text][2]
Edit: It seems that ReadPixels is also reading pixels from the Unity editor. Here is another example:
The first image is what the screen looks like, and the second is what ReadPixels produces.
![alt text][3]
As you can see, a portion of the editor is being read along with the screen. How can we solve this problem?
[1]: http://i48.tinypic.com/2ihbaya.png
[2]: http://i48.tinypic.com/2hye08.png
[3]: http://i49.tinypic.com/21b99iw.png
↧