Get available disk space in Unity

回眸只為那壹抹淺笑 提交于 2019-12-11 01:10:40

问题


UPDATE : I have found a solution for the iOS and Android versions, however, I'm still getting this error when building for Mac and Windows. I've seen a workaround that only gets me the name of the drives :

foreach (string drive in Directory.GetLogicalDrives());

... But that doesn't get me anywhere in terms of free space.

ORIGINAL QUESTION :

I am working in Unity C#.

I'd like to get the free available disk space on the device I'm using. I've tried using System.IO.DriveInfo but it doesn't work as I receive:

NotImplementedException: The requested feature is not implemented.

...when I try to get the drives. I think this is only a Windows problem, but I haven't found a solution doing my research. I'm also wondering if this class will work on Android, iOS and Mac as well.

DriveInfo[] allDrives = DriveInfo.GetDrives();

Why is this not working? And is there a better solution that would work on all platforms?

来源:https://stackoverflow.com/questions/24144003/get-available-disk-space-in-unity

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!