unity 图片转byte数组

有任何问题可以添加 QQ群 207019099

public static byte[] ReadTexture(string path)
    {
        Debug.Log(" @ ! the texture path is + !!    " + path);
        FileStream fileStream = new FileStream(path, FileMode.Open, System.IO.FileAccess.Read);

        fileStream.Seek(0, SeekOrigin.Begin);

        byte[] buffer = new byte[fileStream.Length]; //创建文件长度的buffer   
        fileStream.Read(buffer, 0, (int)fileStream.Length);

        fileStream.Close();

        fileStream.Dispose();

        fileStream = null;

        return buffer;
    }
最新回复(0)
/jishu_2BsrA9YS6wBW3M3EbsV72l_2B1KCshe6UZG3MtSFq_2F8S40_3D4688691
8 简首页