我使用UnityWebRequest来获取流资产文件夹中的文件,因为WWW已经过时,现在在FileWriteAllBytes上我不能正确使用downloader.bytes,因为它是向我返回一个错误,有人能帮我吗?
#if UNITY_ANDROID
// path on streamingasset folder
string path = System.IO.Path.Combine(Application.streamingAssetsPath, "game.dat");
UnityWebRequest downloader = UnityWebRequest.Get(path);
yield return downloader.SendWebRequest();
while (!downloader.isDone)
{
// nothing to be done while downloader gets our db file
}
// then save to application.persistentdatapath
// on this second param i dont know what do right i cant put donwloader.bytes because is obsolete
File.WriteAllBytes(dataFilePath, missing);
#endif发布于 2021-07-23 09:12:56
使用DownloadHandler
UnityWebRequest downloader = UnityWebRequest.Get(path);
yield return downloader.SendWebRequest();
DownloadHandler handler = downloader.downloadHandler;
File.WriteAllBytes(dataFilePath, handler.data);https://stackoverflow.com/questions/68479267
复制相似问题