This is an advanced question, please read it carefully before answering.
For some reasons I need to give the player the ability to open a “file explorer”. The player will click on a button while playing then a window will appear showing him/her the drives on his/her hard disk and then can open folders and browse files.
If this even possible in unity I need it also to access different operating systems (MAC or windows).
I’m not asking anyone to write me a full code or do my job, I just need someone to point me to the right direction… if it’s even possible in unity.
Wow... that's really a handy asset you've got there, nice job Eric5h5. I really appreciate it but in the description you wrote: "Note that UniFileBrowser does not work with web players, since Unity prevents web players from having local file access" What the customer wants is a web version... :(
If Eric5h5 or fafase answers are not what you seek for, and instead you want to run external program, you can use Process class. To open file explorer in Windows, you can use:
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo("explorer.exe");
p.Start();
I think the Process class is not accessible in Unity. Not sure but I think I tried it and it would not load.
That's a good work around, why do I make a file explorer when I can use the regular file explorer? But how can I connect the opened file explorer to my game? for example: the player chooses a txt file to be used in the game.
That's weird... I get an error in Unity at p.StartInfo = new System.Diagnostics.ProcessStartInfo("explorer.exe"); "The type System.Diagnostics.ProcessStartInfo' does not contain a constructor that takes 1' arguments" But I can see in visual studio that it has a constructor that takes a string as an argument. The error is appearing in Unity only, not in visual studio
You originally didn't mention about requirement to run this in web player. I (as all answerers before me) assumed standalone. No operations related to local file system works in web player. There is no work around this, unless you develop in Flash, which, as far as I know, have a possibility of accessing files on local machine.
can anyone tell me how can I give access in android mobile gallery through explorer for pick His/Her picture and use it in app…
I just want from anyone to tell correct path…so that I can easily access to my android mobile during running my
app…
Thanks,it works,i dont know why,but "Process " works on editor but not on runtime. i got "(Exception) Win32Exception: SuccessSystem.Diagnostics.Process.StartWithShellExecuteEx (System.Diagnostics.ProcessStartInfo startInfo)".
Wow... that's really a handy asset you've got there, nice job Eric5h5. I really appreciate it but in the description you wrote: "Note that UniFileBrowser does not work with web players, since Unity prevents web players from having local file access" What the customer wants is a web version... :(
– Jix