Use the native File Browsers
on Mac & Windows!

Features
– Open File Panel / Open Multiple Files Panel,
– Open Folder Panel / Open Multiple Folders Panel,
– Save File Panel,
– Define a starting directory,
– Define the file extensions to be used,
– Clean and documented C# code.

Screenshots

Screenshot1

Testimonials

Introduction

Native File Browser provides an easy way to use the native File Browser on Mac and Windows.
You just call a static methods from the FileBrowser class, and it will display the file browser window for you, giving you a callback for when a file/folder is selected.

You can use the FileBrowser wrapper class if you’re developing for both Mac and Windows, this will automatically call the correct platform methods.
So, using FileBrowser.OpenFilePanel will automatically call:
FileBrowserMac.OpenFilePanel on Mac
FileBrowserWindows.OpenFilePanel on Windows
With that, you don’t have to take care of checking the current platform with Application.platform.

But if you want, you can use the FileBrowserMac and FileBrowserWindows classes and not use the FileBrowser wrapper class.
There’s some small differences between each platform (for example, only Windows allow to define a title), so when calling FileBrowser.OpenFilePanel(title), the title will only be used on Windows.
That’s why the FileBrowserMac.OpenFilePanel does not have a title parameter.

Requirements

Please, make sure you have the following settings, otherwise Native File Browser won’t work:
Windows: There’s a FileBrowser.exe file in StreamingAssets/PygmyMonkey/FileBrowser, it is absolutely required for Native File Browser to work… don’t move it from this exact location.

Open File Panel

Opens the select file panel (Select a single file).
Will only allow to select files with extension defined in extensionArray.

Parameters:
title: Title (Only available on Windows).
startingDirectory: Starting directory (if null, will use the last opened folder).
extensionArray: Extension array (specify only the extension, no symbols (,.*) – example “jpg”, “png”). If null, it will allow any file.
onDone: Callback called when a file has been chosen (It has two parameters. First (bool) to check if the panel has been canceled. Second (string) is the file selected).

Open Multiple Files Panel

Opens the select multiple files panel (Select multiple files).
Will only show files with extension defined in extensionArray.

Parameters:
title: Title (Only available on Windows).
startingDirectory: Starting directory (if null, will use the last opened folder).
extensionArray: Extension array (specify only the extension, no symbols (,.*) – example “jpg”, “png”). If null, it will allow any file.
onDone: Callback called when files have been chosen (It has two parameters. First (bool) to
check if the panel has been canceled. Second (string) is the file selected array).

Open Folder Panel

Opens the select folder panel (Select a single folder).

Parameters:
title: Title (Only available on Windows).
startingDirectory: Starting directory (if null, will use the last opened folder).
onDone: Callback called when a folder has been chosen (It has two parameters. First (bool) to check if the panel has been canceled. Second (string) is the folder selected).

Open Multiple Folders Panel

Opens the select multiple folders panel (Select multiple folders).

Parameters:
title: Title (Only available on Windows).
startingDirectory: Starting directory (if null, will use the last opened folder).
onDone: Callback called when folders have been chosen (It has two parameters. First (bool) to check if the panel has been canceled. Second (string) is the folder selected array).

Save File Panel

Opens the save file panel (Save a file).
Will set the file types dropdown with the extensions defined in extensionArray, if not null.

Parameters:
title: Title (Only available on Windows).
message: A hint message on top of the panel, to display a hint to users (Only available on Mac).
startingDirectory: Starting directory (if null, will use the last opened folder).
defaultName: Default Name of the file to be saved. (If null, no name is pre-filled in the inputField).
extensionArray: Extension array (specify only the extension, no symbols (,.*) – example “jpg”, “png”). If null, it will allow any file.
onDone: Callback called when a folder has been chosen (It has two parameters. First (bool) to check if the panel has been canceled. Second (string) is the folder selected).

How to update Native File Browser

1. Delete everything under the ‘FileBrowser’ folder from the Project View
2. Import the latest version from the Asset Store

Version 1.0.7 - April 20, 2017

  • NEW: Fixed issue when throwing an exception in the callback method on OS X,
  • NEW: The filePath returned when cancel is clicked is now null (previously it was “cancel”).

Version 1.0.6 - March 27, 2017

  • NEW: Added #define NATIVE_FILE_BROWSER in case you need to use this with scripting define symbol
  • NEW: A dispatcher is now automatically included and use to “push” results to the main thread.

Version 1.0.5 - December 11, 2016

  • NEW: Windows: Having multiple extensions is now displayed under a single dropdown (instead of multiples).

Version 1.0.4 - September 29, 2016

  • NEW: Added possibility to define the button name on Mac (not easily possible on Windows).

Version 1.0.3 - September 9, 2016

  • FIX: Windows: Fixed issue happening when a LOT of files were selected.

Version 1.0.2 - August 10, 2016

  • FIX: Windows: Fix startingDirectory not working if the path contained / instead of \. You can now safely use paths with either / or \.
  • FIX: Windows: Fixed possible issue because result return was not Trim(),
  • NEW: Added FAQ “Why are you using a .exe file on Windows?”.

Version 1.0.1 - August 5, 2016

  • FIX: Fixed Native File Browser not working when building with architecture x86 on Mac. It now works with any architecture (Universal, x86 and x64)
  • NEW: The FileBrowser on Mac now always display the “Create folder” button

Version 1.0.0 - July 26, 2016

  • Initial release.

Support

FAQ

Why are you using a .exe file on Windows?

At first I wanted to make a DLL that does all the work. But in order to use the File Browser UI we’re used to on Windows, you have to target at least .NET 4.5 when creating the Library (DLL).
Which is not compatible and won’t load in Unity…

So you’ll have to target .NET 3.5. But when you’re doing that, C# will use an old, ugly UI for the FileBrowser:

So I built a FileBrowser.exe file (with .NET 4.5), placed it in the StreamingAssets folder (to be able to find/load it at runtime in a build), and communicate back to the main app by reading the return value of the Process.Start method (see FileBrowserWindows.cs for that).

What platforms are supported?

Only Mac and Windows standalone platforms are supported.

How can I help?

Thank you! You can take a few seconds and rate the tool in the Asset Store and leave a nice comment, that would help a lot 😉

What's the minimum Unity version required?

Gif Recorder will work starting with Unity 5.0.0.