保存Texture2D为png图片

作者:追风剑情 发布于:2015-6-16 14:18 分类:Unity3d

//保存Texture2D为png图片
    public static void SavePNG(string filePath, Texture2D texture)
    {
        try
        {
            byte[] pngData = texture.EncodeToPNG();
            File.WriteAllBytes(filePath, pngData);
        }
        catch (Exception ex)
        {
            Debug.Log(ex.StackTrace);
        }
    }

标签: Unity3d

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号