Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
1
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

8 Replies

· Add your reply
  • Sort: 
avatar image
3

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

Answer by pimichel · May 13, 2020 at 08:31 PM

Hello, you can use this :

Application.OpenURL("file:///" + your Path);

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

Follow this Question

Answers Answers and Comments

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges