Save Image

Hi guys. I want to make the scene save in the gallery of the android phone when the button is click? can you help me doing that? if there is another way please tell me and ill try it. I badly need it now. :frowning:

The last answer had some messy code I tryed to clean a bit but perhaps you can use it.

IEnumerator ScreenshotEncode()
    {
        yield return new WaitForEndOfFrame();
        Texture2D texture1 = new Texture2D (Screen.width, Screen.height, TextureFormat.RGB24, false);
        texture1.ReadPixels (new Rect(0, 0, Screen.width, Screen.height), 0, 0);
        texture1.Apply();
        yield return 0;

        byte [] bytes = texture1.EncodeToJPG();
        File.WriteAllBytes( "/mnt/sdcard/DCIM/Images/" + "InsertName" +".jpg",bytes );
    }

this is the code that i will try?

This code take a screenshot into a Texture2d and saves it. If you have a Texture2d already, just use the last 2 lines of code.