Bypp
Bypp

Reputation: 331

Get available disk space in Unity

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?

Upvotes: 3

Views: 3993

Answers (0)

Related Questions