Skip to content

Latest commit

 

History

History
72 lines (53 loc) · 1.85 KB

File metadata and controls

72 lines (53 loc) · 1.85 KB

Unity File Browser

openupm

A utility package to use file browser related things in Unity Runtime.

Features

  • File picker(utilizes rfd)
    • Single file
    • Multiple files
    • Single directory
    • Multiple directories
  • Reveal a path(utilizes opener)

Installation

Option 1: Use openupm

  • Run command: openupm add com.7thbeat.filebrowser

Option 2: Use git url to install (uses latest commit)

  • Window -> Package Manager in unity editor
  • Click the + button, and Add package from Git URL
  • Paste git+https://github.com/7thbeatgames/UnityFileBrowser.git?path=Packages/com.7thbeat.filebrowser

Examples

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();