skip to Main Content

There is any way with code to export a .png or .tga file to local disk in Unity?
I need to write a converter that loads asset bundles and converts them to the original
source image files. I need to create those files, in a way that anyone could open them
with Photoshop, for instance. Any idea about how to do it?

Thanks.
David

2

Answers


  1. You can save image in TGA format using Encode To TGA plugin: http://u3d.as/rWt

    Login or Signup to reply.
  2. void Save(Texture2D texture)
    {
        var bytes = texture.EncodeToPNG();
        File.WriteAllBytes(EditorUtility.SaveFilePanel("Save PNG", Application.dataPath + "/../", "Font", "png"), bytes);
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search