• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jix · Nov 27, 2013 at 08:24 PM · file-ioexplorer

Opening a file explorer in run time?

Hello,

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.

I develop in C#.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

7 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by ArkaneX · Nov 27, 2013 at 08:39 PM

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();
Comment
Add comment · Show 11 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fafase · Nov 27, 2013 at 08:47 PM 0
Share

I think the Process class is not accessible in Unity. Not sure but I think I tried it and it would not load.

avatar image ArkaneX · Nov 27, 2013 at 08:58 PM 0
Share

It works, at least in Windows. Not sure about $$anonymous$$ac though.

avatar image Jix · Nov 27, 2013 at 09:05 PM 0
Share

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.

avatar image Jix · Nov 27, 2013 at 09:12 PM 0
Share

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

avatar image fafase · Nov 28, 2013 at 06:51 AM 1
Share

If you need web development you would have to add a Javascript method (the web Js not Unity Js) to your html file. Then you call it using http://docs.unity3d.com/Documentation/ScriptReference/Application.ExternalCall.html

Concerning file explorer with Js, should have that.

Show more comments
avatar image
1

Answer by Eric5h5 · Nov 27, 2013 at 08:31 PM

http://www.starscenesoftware.com/unifilebrowser.html

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jix · Nov 27, 2013 at 08:54 PM 0
Share

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... :(

avatar image
1

Answer by fafase · Nov 27, 2013 at 08:34 PM

There is one on the wiki: http://wiki.unity3d.com/index.php?title=ImprovedFileBrowser

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jix · Nov 27, 2013 at 08:56 PM 0
Share

Thanks, does it works with web versions?

avatar image fafase · Nov 27, 2013 at 09:01 PM 0
Share

well, I would think it should not for security reason. Not sure though.

avatar image
1

Answer by PygmyMonkey · Aug 05, 2016 at 10:51 AM

Hello,

I made an Asset to use the Native File Browser from Windows and Mac in Unity at runtime, it's available on the Asset Store: https://www.assetstore.unity3d.com/en/#!/content/68064

I've been searching for a way to do that for more than a year... and finally found how to do it :)

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Silent-Inventors · Nov 03, 2016 at 07:59 AM

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...

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jix · Nov 03, 2016 at 01:09 PM 0
Share

I suggest that you buy this asset, it has many features for Android and its support is so good https://www.assetstore.unity3d.com/en/#!/content/10825

  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Simple Native App WWW Asset Caching System 1 Answer

Why data will be overwrite in the file 1 Answer

Load text file on Streaming assets in Android 4 Answers

Set up spawn seqence based on specified timing 1 Answer

Loading Textures during runtime and applying to Raw Images 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges