Is there a way for a Unity application to get full access to the filesystem? In my case, I am simply trying to allow the user to browse their file system to get to, for example, a profile photo, so they can give me the path and I can then load that file using WWW. However, any time I try to use System.IO.DirectoryInfo → GetDirectories(), the list of directories is empty. When I run in the Editor, I can see the current Unity project folder, but when I build, I just get an empty directory. For example
System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
);
var files = dirInfo.GetFiles("*.*", System.IO.SearchOption.TopDirectoryOnly);
var dirs = dirInfo.GetDirectories("*.*", System.IO.SearchOption.TopDirectoryOnly);
Both dirs and files vars will 100% be empty (I have tried different wildcard options in there as well). Is there any reasonable way to do this?
From what I can see, it seems like I will need to either utilize some HTML/JS-based solution to get a input type=file, or, write native code for each individual supported platform. I am worried about going down either of these two routes though, because if I am still sandboxed from there, then I will waste a colossal amount of time.
Thanks!