IEnumerator CRCaptureScreenshot() { // Wait for right timing to take screenshot yield return(new WaitForEndOfFrame()); #if UNITY_ANDROID if (screenshotRT != null) { // Temporarily render the camera content to our screenshotRenderTexture. // Later we'll share the screenshot from this rendertexture. Camera.main.targetTexture = screenshotRT; Camera.main.Render(); yield return(null); Camera.main.targetTexture = null; yield return(null); // Read the rendertexture contents RenderTexture.active = screenshotRT; capturedScreenshot = new Texture2D(screenshotRT.width, screenshotRT.height, TextureFormat.RGB24, false); capturedScreenshot.ReadPixels(new Rect(0, 0, screenshotRT.width, screenshotRT.height), 0, 0); capturedScreenshot.Apply(); RenderTexture.active = null; } #else capturedScreenshot = MobileNativeShare.CaptureScreenshot(); #endif }
IEnumerator CRCaptureScreenshot() { // Wait for right timing to take screenshot yield return(new WaitForEndOfFrame()); capturedScreenshot = MobileNativeShare.CaptureScreenshot(); }
public void ShareScreenshot() { string path = System.IO.Path.Combine(Application.persistentDataPath, screenshotFilename); string msg = shareMessage; msg = msg.Replace("[score]", ScoreManager.Instance.Score.ToString()); MobileNativeShare.ShareImage(path, screenshotFilename, msg); }
IEnumerator CRSaveScreenshot() { yield return(new WaitForEndOfFrame()); TwoStepScreenshotPath = MobileNativeShare.SaveScreenshot(TwoStepScreenshotName); Debug.Log("A new screenshot was saved at " + TwoStepScreenshotPath); }
void ShareURL(string url) { if (string.IsNullOrEmpty(url)) { Debug.LogWarning("ShareURL failed: the given URL is invalid."); return; } MobileNativeShare.ShareURL(url); }
public void ShareScreenshot() { if (!string.IsNullOrEmpty(TwoStepScreenshotPath)) { MobileNativeShare.ShareImage(TwoStepScreenshotPath, sampleMessage); } else { Debug.Log("Please save a screenshot first."); } }
IEnumerator CROneStepSharing() { yield return(new WaitForEndOfFrame()); HidePanel(); yield return(new WaitForSeconds(0.35f)); bottomBanner.SetActive(true); yield return(new WaitForEndOfFrame()); MobileNativeShare.ShareScreenshot("screenshot", ""); bottomBanner.SetActive(false); }
public void ShareScreenshot() { if (capturedScreenshot == null) { Debug.Log("ShareScreenshot: FAIL. No captured screenshot."); return; } string msg = shareMessage; msg = msg.Replace("[score]", ScoreManager.Instance.Score.ToString()); MobileNativeShare.ShareTexture2D(capturedScreenshot, screenshotFilename, msg); }
IEnumerator ScreenShot() { yield return(new WaitForEndOfFrame()); Texture2D pic = MobileNativeShare.CaptureScreenshot(); if (pic == null) { Debug.Log("Texture from screenshot not successful."); } MobileNativeShare.ShareTexture2D(pic, "LerperScreen", "", ""); }
void SharePNG() { if (ImgTex == null) { Debug.Log("SharePNG failed: no captured screenshot."); return; } #if EASY_MOBILE MobileNativeShare.ShareTexture2D(ImgTex, ScreenshotSharer.Instance.pngFilename, ConstructShareMessage()); #else Debug.Log("Sharing feature requires Easy Mobile plugin."); #endif }
public void ShareScreenshot() { if (capturedScreenshot == null) { Debug.Log("ShareScreenshot: FAIL. No captured screenshot."); return; } string msg = shareMessage; msg = msg.Replace("[score]", ScoreManager.Instance.Score.ToString()); if (shareAppUrl) { #if UNITY_IOS msg += "\n\n" + AppInfo.Instance.APPSTORE_SHARE_LINK; #elif UNITY_ANDROID msg += "\n\n" + AppInfo.Instance.PLAYSTORE_SHARE_LINK; #endif } MobileNativeShare.ShareImageByTexture2D(capturedScreenshot, "sglib_screenshot.png", msg); }
IEnumerator CRCaptureScreenshot() { #if UNITY_ANDROID if (screenshotRenderTexture != null) { // Wait for right timing to take screenshot yield return(new WaitForEndOfFrame()); // Temporarily render the camera content to our screenshotRenderTexture. // Later we'll share the screenshot from this rendertexture. Camera.main.targetTexture = screenshotRenderTexture; Camera.main.Render(); yield return(null); Camera.main.targetTexture = null; } #else // Wait for right timing to take screenshot yield return(new WaitForEndOfFrame()); capturedScreenshot = MobileNativeShare.CaptureFullScreenshot(); #endif }
IEnumerator CROneStepSharing() { yield return(new WaitForEndOfFrame()); MobileNativeShare.ShareScreenshot("screenshot", ""); }
IEnumerator CROneStepSharing() { yield return(new WaitForEndOfFrame()); MobileNativeShare.ShareScreenshot(OneStepScreenshotName, sampleMessage); }
IEnumerator CROneStepSharing() { yield return(new WaitForEndOfFrame()); MobileNativeShare.ShareScreenshot("screenshot", "https://play.google.com/store/apps/details?id=com.applecakestudios.archer"); }
IEnumerator DisplayMenuUI(float delay = 0f, bool isGameOverUI = false) { if (delay > 0f) { yield return(new WaitForSeconds(delay)); } freeGifts.gameObject.SetActive(true); playButton.SetActive(true); menuButtons.SetActive(true); shareButton.SetActive(false); if (!isGameOverUI) { title.SetActive(true); } else { selectCharacterButton.SetActive(false); score.gameObject.SetActive(true); // Show New Best score. if (ScoreManager.Instance.HasNewHighScore) { newBestScore.SetActive(true); } // Show Share button. #if UNITY_ANDROID if (enableSharing && screenshotRenderTexture != null && screenshotRenderTexture.IsCreated()) { capturedScreenshot = MobileNativeShare.CaptureFullScreenshot(screenshotRenderTexture); yield return(new WaitForSeconds(0.2f)); shareImageSprite = Utilities.Instance.Texture2DToSprite(capturedScreenshot); Transform imgTf = shareImage.transform; Image imgComp = imgTf.GetComponent <Image>(); float scaleFactor = imgTf.GetComponent <RectTransform>().rect.width / shareImageSprite.rect.width; imgComp.sprite = shareImageSprite; imgComp.SetNativeSize(); imgTf.localScale = new Vector3(scaleFactor, scaleFactor, scaleFactor); yield return(new WaitForSeconds(0.3f)); shareButton.SetActive(true); } #else if (enableSharing && capturedScreenshot != null) { yield return(new WaitForSeconds(0.2f)); shareImageSprite = Utilities.Instance.Texture2DToSprite(capturedScreenshot); Transform imgTf = shareImage.transform; Image imgComp = imgTf.GetComponent <Image>(); float scaleFactor = imgTf.GetComponent <RectTransform>().rect.width / shareImageSprite.rect.width; imgComp.sprite = shareImageSprite; imgComp.SetNativeSize(); imgTf.localScale = new Vector3(scaleFactor, scaleFactor, scaleFactor); yield return(new WaitForSeconds(0.3f)); shareButton.SetActive(true); } #endif } }
void ShareLink() { #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR MobileNativeShare.ShareScreenshot("screenshot", ""); #endif }