Ejemplo n.º 1
0
        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
        }
Ejemplo n.º 2
0
        IEnumerator CRCaptureScreenshot()
        {
            // Wait for right timing to take screenshot
            yield return(new WaitForEndOfFrame());

            capturedScreenshot = MobileNativeShare.CaptureScreenshot();
        }
Ejemplo n.º 3
0
    IEnumerator ScreenShot()
    {
        yield return(new WaitForEndOfFrame());

        Texture2D pic = MobileNativeShare.CaptureScreenshot();

        if (pic == null)
        {
            Debug.Log("Texture from screenshot not successful.");
        }

        MobileNativeShare.ShareTexture2D(pic, "LerperScreen", "", "");
    }