91 mainCam = Camera.main;
97 directorypath = Application.dataPath +
"/../Screenshots/" +
GUIDisplay.
id;
100 directorypath = Application.dataPath +
"/../Screenshots/" +
GUIDisplay.
id+
"-"+idseq.ToString()+
"/";
101 if(!
System.IO.Directory.Exists(directorypath)){
103 System.IO.Directory.CreateDirectory(directorypath);
105 Application.CaptureScreenshot(directorypath+
GUIDisplay.
id+
"-"+Time.frameCount.ToString()+
".png",1);
109 if(!
System.IO.Directory.Exists(directorypath)){
111 System.IO.Directory.CreateDirectory(directorypath);
114 directorypath +=
"/" + DateTime.Now.ToString (
"yyyyMMdd-Hmmss");
119 Application.CaptureScreenshot(directorypath+
".png", upscaleFactor);
126 RenderTexture rt =
new RenderTexture(width*upscaleFactor, height*upscaleFactor, 32);
127 mainCam.targetTexture = rt;
130 Color saveCameraColor = mainCam.backgroundColor;
131 mainCam.backgroundColor =
new Color(saveCameraColor.r,saveCameraColor.g,saveCameraColor.b,0f);
133 Texture2D sshot =
new Texture2D(width*upscaleFactor, height*upscaleFactor,TextureFormat.ARGB32,
false);
135 RenderTexture.active = rt;
137 sshot.ReadPixels(
new Rect(0, 0, width*upscaleFactor, height*upscaleFactor), 0, 0);
139 byte[] pngShot = sshot.EncodeToPNG();
142 File.WriteAllBytes(path, pngShot);
144 mainCam.targetTexture = null;
145 RenderTexture.active = null;
148 mainCam.backgroundColor = saveCameraColor;
static bool backGroundTrans
!WiP Includes FLAGS of GUI.
!WiP manage GUI, and provide static strings for the GUI.
void takeTransparentScreenshot(int width, int height, string path, int upscaleFactor)