public void OniOSMediaSharingClick()
    {
        Debug.Log("Media Share");
#if UNITY_IPHONE
        byte[] bytes = MyImage.EncodeToPNG();
        string path  = Application.persistentDataPath + "/MyImage.png";
        File.WriteAllBytes(path, bytes);

        string path_ = "MyImage.png";


        StartCoroutine(ScreenshotHandler.Save(path_, "Media Share", true));
#endif
    }
Esempio n. 2
0
    public void OnShareTextWithImage()
    {
        Debug.Log("Media Share");
                #if UNITY_ANDROID
        StartCoroutine(SaveAndShare());
                #elif UNITY_IPHONE || UNITY_IPAD
        byte[] bytes = MyImage.EncodeToPNG();
        string path  = Application.persistentDataPath + "/MyImage.png";
        File.WriteAllBytes(path, bytes);
        string path_ = "MyImage.png";

        StartCoroutine(ScreenshotHandler.Save(path_, "Media Share", true));
                #endif
    }
Esempio n. 3
0
    public IEnumerator captureScreen()
    {
        yield return(new WaitForEndOfFrame());

        var width  = Screen.width;
        var height = Screen.height;
        var tex    = new Texture2D(width, height, TextureFormat.RGB24, false);

        // Read screen contents into the texture
        tex.ReadPixels(new Rect(0, 0, width, height), 0, 0);
        tex.Apply();

        // Encode texture into PNG
        var bytes = tex.EncodeToPNG();

        Destroy(tex);
        string path = Application.persistentDataPath + "/SavedScreen.png";

        File.WriteAllBytes(path, bytes);
        string path_ = "SavedScreen.png";

        StartCoroutine(ScreenshotHandler.Save(path_, "Media Share", true));
    }