IEnumerator CaptureScreenshot2 (Rect Rect) {//Create an empty texture first, the size can be set according to the implementation needs texture2d screenshot = new Tex
Ture2d (Screen.width, screen.height/*, Textureformat.rgb24, false*/); Canvas.
SetActive (false);//Screen UI yield return new Waitforendofframe ();
Reads screen pixel information and stores it as texture data, screenshot.readpixels (rect, 0, 0);
Screenshot.apply ();
Then put these texture data into a PNG picture file byte[] bytes = Screenshot.encodetopng (); Canvas.
SetActive (TRUE);
-----Create a picture locally string filename = Application.datapath + "/screenshot.png";
System.IO.File.WriteAllBytes (filename, bytes); Debug.Log (String.
Format ("Screenshot of a picture: {0}", filename));
Create a picture-----network string tempS = System.Convert.ToBase64String (bytes);
Wwwform form = new Wwwform (); Form.
AddField ("image", TempS);
www www = new www ("http://project.weily.org/uim/index.php", form);
yield return www;
Print (Www.text); //-----In ngui3xx version, copy the path to the clipboard texteditor te = new TextEditor ();
Te.content = new Guicontent ("http://project.weily.org/uim/" + www.text); Te.
Onfocus (); Te.
Copy (); }
Note Notes ~