/// <summary> /// 保存AssetBundle文件到本地 /// </summary> private void SaveAssetBundle(AssetBundleWriteArgs args) { FileInfo fileInfo = new FileInfo(args.Path); FileStream fs = fileInfo.Create(); //fs.Write(字节数组, 开始位置, 数据长度); fs.Write(args.Bytes, 0, args.Bytes.Length); fs.Flush(); //文件写入存储到硬盘 fs.Close(); //关闭文件流对象 fs.Dispose(); //销毁文件对象 }
public void DownLoadResourcesAndSave(string relativePath) { string path = NetSystemFacade.ResourceURL + "/" + relativePath + "." + FileExtension; AssetBundleStream abStream = new AssetBundleStream(); abStream.OnLoadFinish += () => { AssetBundleWriteArgs args = new AssetBundleWriteArgs(); args.Bytes = abStream.Bytes; args.Path = path; abStream.WriteResource(args); }; abStream.ReadResouce(path); }