当前位置:   article > 正文

unity Texture2d Base64 相互转换_assetstudio.texture2dconverter.decodergba32(bytell

assetstudio.texture2dconverter.decodergba32(bytell image data, bytelbuff) 份
//Base64ToTexture2D
    public Texture2D Base64ToTexture2D(string Base64STR)
    {
        Texture2D pic = new Texture2D(190, 190, TextureFormat.RGBA32, false);
        byte[] data = System.Convert.FromBase64String(Base64STR);
        pic.LoadImage(data);
        return pic;
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
//Texture2DToBase
    public String Texture2DToBase64(Texture2D t2d)
    {
        byte[] bytesArr = t2d.EncodeToJPG();
        string strbaser64 = Convert.ToBase64String(bytesArr);
        return strbaser64;
    }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

好使

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号