You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Changed folderMode parameter to pickMode that supports picking files and folders simultaneously
- Added optional initialFilename parameter to prefill the filename input field
- Files and folders are now sorted by their names (they weren't automatically sorted on some platforms)
- Made AllFilesFilterText, FoldersFilterText and PickFolderQuickLinkText properties public static so that these labels can be localized or customized
- Write External Storage permission is now added automatically on Android (no manual setup is needed)
Copy file name to clipboardExpand all lines: .github/README.md
+20-19Lines changed: 20 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@
20
20
- Supports runtime permissions on Android M+ and *Storage Access Framework* on Android Q+
21
21
- Optimized using a recycled list view (makes *Instantiate* calls sparingly)
22
22
23
-
**NOTE:** Universal Windows Platform (UWP) is not supported!
23
+
**NOTE:***Universal Windows Platform (UWP)* and *WebGL* platforms aren't supported!
24
24
25
25
## INSTALLATION
26
26
@@ -40,41 +40,39 @@ There are 5 ways to install this plugin:
40
40
41
41
If your project uses ProGuard, try adding the following line to ProGuard filters: `-keep class com.yasirkula.unity.* { *; }`
42
42
43
-
-**File browser doesn't show any files on Android**
43
+
-**File browser doesn't show any files on Android 10+**
44
44
45
-
Make sure that you've set the **Write Permission** to **External (SDCard)** in *Player Settings*. On Android 10+, file browser uses *Storage Access Framework* and users must click the *Pick Folder* button first.
45
+
File browser uses *Storage Access Framework*on these Android versions and users must first click the *Pick Folder* button in the quick links section
46
46
47
-
-**RequestPermission returns Permission.Denied on Android even though I've set "Write Permission" to "External (SDCard)"**
47
+
-**RequestPermission returns Permission.Denied on Android**
48
48
49
49
Declare the `WRITE_EXTERNAL_STORAGE` permission manually in your [**Plugins/Android/AndroidManifest.xml** file](https://answers.unity.com/questions/982710/where-is-the-manifest-file-in-unity.html) with the `tools:node="replace"` attribute as follows: `<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>` (you'll need to add the `xmlns:tools="http://schemas.android.com/tools"` attribute to the `<manifest ...>` element).
50
50
51
51
## HOW TO
52
52
53
-
*for Android*: set **Write Permission** to **External (SDCard)** in **Player Settings**
54
-
55
53
**NOTE:** On *Android Q (10)* or later, it is impossible to work with *File* APIs. On these devices, SimpleFileBrowser uses *Storage Access Framework (SAF)* to browse the files. However, paths returned by SAF are not File API compatible. To simulate the behaviour of the File API on all devices (including SAF), you can check out the **FileBrowserHelpers** functions. For reference, here is an example SAF path: `content://com.android.externalstorage.documents/tree/primary%3A/document/primary%3APictures`
56
54
57
55
First, add `using SimpleFileBrowser;` to your script.
58
56
59
57
The file browser can be shown either as a **save dialog** or a **load dialog**. In load mode, the returned path(s) always lead to existing files or folders. In save mode, the returned path(s) can point to non-existing files, as well. You can use the following functions to show the file browser:
There can only be one dialog active at a time. These functions will return *true* if the dialog is shown successfully (if no other dialog is active), *false* otherwise. You can query the **FileBrowser.IsOpen** property to see if there is an active dialog at the moment.
70
68
71
-
If user presses the *Cancel* button, **onCancel** callback is called. Otherwise, **onSuccess** callback is called with the paths of the selected files/folders as parameter. When **folderMode**is set to *true*, the file browser will show only folders and the user will pick folders instead of files. Setting **allowMultiSelection** to *true* will allow picking multiple files/folders.
69
+
If user presses the *Cancel* button, **onCancel** callback is called. Otherwise, **onSuccess** callback is called with the paths of the selected files/folders as parameter. **pickMode**can be *Files*, *Folders* or *FilesAndFolders*. Setting **allowMultiSelection** to *true* will allow picking multiple files/folders.
72
70
73
71
There are also coroutine variants of these functions that will yield while the dialog is active:
After the dialog is closed, you can check the **FileBrowser.Success** property to see whether the user has selected some files/folders or cancelled the operation and if FileBrowser.Success is set to *true*, you can use the **FileBrowser.Result** property to get the paths of the selected files/folders.
@@ -205,17 +203,19 @@ public class FileBrowserTest : MonoBehaviour
205
203
// onSuccess event: not registered (which means this dialog is pretty useless)
206
204
// onCancel event: not registered
207
205
// Save file/folder: file, Allow multiple selection: false
0 commit comments