void WriteDataToLocalFile(string filePath, byte[] bytes)
{
if (File.Exists(filePath))
File.Delete(filePath);
using (FileStream fs = new FileStream(filePath, FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
fs.Close();
fs.Dispose();
}
Debug.Log("写入完毕:" + filePath);
}
用的这段代码写入文件,但是每次都提示filePath这个路径拒绝访问。错误提示:UnauthorizedAccessException: Access to the path'D:\UnityProject\FramWork\FramWork_Client_tolua\FrameWork_ClientTolua\Assets\StreamingAssets\NetAssetBundle' is denied.
以前还从来没遇到过这个问题,怎么解啊
同学你好,可以参考一下:
https://tieba.baidu.com/p/5879612906?red_tag=3196287712
https://blog.csdn.net/qq_15021025/article/details/78630487
https://stackoverflow.com/questions/55422248/unity-unauthorizedaccessexception-access-to-the-path-is-denied