Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
0
Question by heyhey · Jun 27, 2011 at 05:50 PM · filebrowser

Open Windows Explorer.

Is there a way for a user to click on a button in-game and have a window pop up like Windows Explorer (or Finder for Mac OS) where you can navigate through directories and open a selected file? I have written code for a customized File Browser but I want to use the built in file browser for windows/mac. Any help would be greatly appreciated Thanks!

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by CHPedersen · Jun 28, 2011 at 12:51 PM

There is always a way, but what you're asking makes your application platform specific. Unity was built for the exact opposite, (hence its name), so accessing platform specific material such as the windowing system requires you to grab the dll's that are native to that particular operating system, and call the external functions that manipulate the window system on that platform.

I haven't looked deeply into this myself because frankly, it's too high effort to be worth it. But the functions that you would require on Windows are probably located in User32.dll. There is a list of Win32 API lowlevel functions that reside in User32.dll here:

http://www.webtropy.com/articles/art9-2.asp?lib=user32.dll

As you can see, many of them operate on windows, like moving them around, closing them, finding them based on their caption, etc. etc. But they all require you to handle unmanaged memory, and the variables become hairy, the code hard to read and hard to debug.

And then if you do manage to get this working, you'd have to start the same research all over again when you want to do the same on a Mac, because it has a different window system, and a different set of external functions for you to manage and wrap your code around. All in all, there is no wrapped, catch-all functionality in Unity that does this for you, for platform independency reasons.

There is an editor function:

http://unity3d.com/support/documentation/ScriptReference/EditorUtility.OpenFilePanel.html

That does what you want in the editor, but that won't work with the final build so probably won't be of much use for you. There are also a few posts with people who've used the .Net Windows Forms library to try and open file dialogs, such as this one:

http://answers.unity3d.com/questions/14869/how-to-open-a-windows-file-open-or-save-dialog-wit.html

But it seems to have varying degrees of success. If I were you, I'd go with some file browser made in unity itself. That seems to be the best bet. Daniel Brauer has written one here:

http://www.unifycommunity.com/wiki/index.php?title=ImprovedFileBrowser

I've used his with great results, and modyfied it to make it into a SaveFile-dialog, too.

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 heyhey · Jun 28, 2011 at 03:04 PM 0
Share

Thanks for your response. I was thinking that it would be a hassle trying to take this route so I think I might just implement the custom file browser that I have worked on. I might even try out that ImprovedFileBrowser. Thanks again!

avatar image
0

Answer by PygmyMonkey · Aug 05, 2016 at 10:52 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

file browser error 1 Answer

How can I have the user chose a filesave location for a c document? 0 Answers

Hide hidden directories in file browser. 1 Answer

how to solve null reference on file browser script 1 Answer

File browser 0 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