public static Texture2D GetScreenshot() { #if UNITY_EDITOR // Application.CaptureScreenshot("Screenshot.png"); // return Load("Screenshot.png"); Vector2 offset = SCrossHelper.GetMainGameViewPosition(); Texture2D screenshot = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); screenshot.ReadPixels(new Rect(offset.x, offset.y, Screen.width, Screen.height), 0, 0); screenshot.Apply(); return screenshot; #else Texture2D screenshot = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false); screenshot.ReadPixels(new Rect(0, 0, Screen.width, Screen.height), 0, 0); screenshot.Apply(); return screenshot; #endif }
public bool Save() { return(SCrossHelper.Save <SCrossResourse>(this, resourceFile)); }