A utility package to use file browser related things in Unity Runtime.
- File picker(utilizes rfd)
- Single file
- Multiple files
- Single directory
- Multiple directories
- Reveal a path(utilizes opener)
Option 1: Use openupm
- Run command:
openupm add com.7thbeat.filebrowser
Option 2: Use git url to install (uses latest commit)
Window->Package Managerin unity editor- Click the
+button, andAdd package from Git URL - Paste
git+https://github.com/7thbeatgames/UnityFileBrowser.git?path=Packages/com.7thbeat.filebrowser
See the description of each method for more details.
Basic file picker
var path = FileBrowser.PickFile(
directory: Application.persistentDataPath,
filterName: "Log file",
filterExtensions: new[] { "log" },
title: "Select a log file"
);Basic save file picker
var path = FileBrowser.SaveFile(
directory: Application.persistentDataPath,
filename: "hello.log",
filterName: "Log file",
filterExtensions: new[] { "log" },
title: "save file!"
);FileDialog example (Advanced)
using var dialog = new FileDialog();
dialog.SetTitle("Example dialog!");
dialog.SetDirectory(Application.persistentDataPath);
dialog.AddFilter("Text file", new[] { "txt" });
dialog.AddFilter("JSON file", new[] { "json" }); // you can add multiple filters!
var path = dialog.PickFile();