static IEnumerator ApplicationScreenshot(RequestAdapter req) { var filename = "screenshot.png"; if (Application.platform != RuntimePlatform.Android && Application.platform != RuntimePlatform.IPhonePlayer) { filename = Application.persistentDataPath + '/' + filename; } #if UNITY_5 Application.CaptureScreenshot(filename); #else ScreenCapture.CaptureScreenshot(filename); #endif yield return(new WaitForSeconds(1.0f)); req.Redirect("/file/persistent/screenshot.png?" + Util.RandomString(6)); }
static IEnumerator TakeScreenshot(RequestAdapter req, string path) { // save screenshot var filename = Path.Combine(HandlerFile.GetPath("persistent"), "screenshot.png"); #if UNITY_5 Application.CaptureScreenshot(filename); #else ScreenCapture.CaptureScreenshot(filename); #endif UniumComponent.Log("Screenshot '" + filename + "'"); // screenshots don't happen immediately, so defer a redirect for a small amount of time yield return(new WaitForSeconds(1.0f)); req.Redirect("/file/persistent/screenshot.png?cb=" + Util.RandomString()); }