Hi every one, im working in a Script that save the screenshot in PNG with transparency background.
here my code
var SSName:String = "screen_test";
private var display: Renderer;
function Update ()
{
if(Input.GetKeyUp ("space")){
ScreenShot();
}
}
function ScreenShot(){
//var width = Screen.width;
//var height = Screen.height;
var width = 3000;
var height = 1500;
var tex = new Texture2D (width, height, TextureFormat.ARGB32, false);
tex.ReadPixels (Rect(0, 0, width, height), 0, 0);
tex.Apply ();
RenderTexture.active = null;
var bytes = tex.EncodeToPNG();
Destroy (tex);
System.IO.File.WriteAllBytes(SSName + ".png", bytes);
}
All works great! the problem i have is that i want to change the resolution of the screenshot to 3000x1500.
When I change it by code i got a this error.
Trying to read pixel out of bounds
And save a screenshot in gray color.
any idea way if i change the resolution the screenshot is saved in graycolor?
thanks