I'm trying to capture the screen to a `Texture2D` so I can draw some custom pixels over the image and then display the frozen image back to the player as a `GUITexture`. When testing my capture code it seems the `captureRegion` requires an offset equal that to the offset of the game screen in the Unity Editor, rather than simply `Rect(0,0,Screen.width,Screen.height)`. So if I set the Game view to "iPad Tall (768x1024)", because of my monitor layout there is a buffer of pixels around the image - and that buffer is being captured. Repeated captures will cause the image to shift up and to the right with the dark grey game view boundary repeating. Oddly, sometimes my Inspector even gets captured as a partially transparent image and overlaid on the `GUITexture`.
Am I doing something wrong?? What do I do instead? Thanks!
var captureRegion:Rect = Rect(0,0,Screen.width,Screen.height);
function CaptureScreen()
{
if(captureScreen)
{
captureScreen = false;
guiTxtr.enabled = false;
txtr = new Texture2D(Screen.width, Screen.height);
txtr.filterMode = FilterMode.Point;
txtr.ReadPixels(captureRegion, 0, 0);
txtr.Apply();
guiTxtr.enabled = true;
guiTxtr.texture = txtr;
}
}