IEnumerator CaptureToTexture() { // The texture must be initialized before calling the capture method. if (m_TargetTexture == null) { m_TargetTexture = new Texture2D(2, 2); } // We call the capture coroutine and wait for its termination yield return(StartCoroutine(m_ScreenshotTaker.CaptureScreenToTextureCoroutine(m_TargetTexture))); // We apply the texture to the GUI element m_RawImage.texture = m_TargetTexture; }
IEnumerator CaptureToTexture() { // The texture must be initialized before calling the capture method. if (TargetTexture == null) { TargetTexture = new Texture2D(2, 2); } ScreenshotTaker.GetComponent <AudioSource>().Play(0); // We call the capture coroutine and wait for its termination yield return(StartCoroutine(ScreenshotTaker.CaptureScreenToTextureCoroutine(TargetTexture))); // We apply the texture to the GUI element AppController.ScreenShotTexture = TargetTexture; }
IEnumerator CaptureToTexture(string action = "share") { if (TargetTexture == null) { TargetTexture = new Texture2D(2, 2); } yield return(StartCoroutine(ScreenshotTaker.CaptureScreenToTextureCoroutine(TargetTexture))); if (action == "share") { ShareSheet _shareSheet = new ShareSheet(); _shareSheet.Text = "SGFing Vote On Nov 6th!"; _shareSheet.AttachImage(TargetTexture); NPBinding.UI.SetPopoverPointAtLastTouchPosition(); NPBinding.Sharing.ShowView(_shareSheet, FinishedSharing); } if (action == "save") { NPBinding.MediaLibrary.SaveImageToGallery(TargetTexture, SaveImageToGalleryFinished); } }