-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Changed folderMode parameter to pickMode that supports picking file…
…s 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)
- Loading branch information
Showing
19 changed files
with
218 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.yasirkula.unity"> | ||
<uses-sdk android:targetSdkVersion="4" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace" /> | ||
</manifest> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
4 changes: 2 additions & 2 deletions
4
...rowser/Android/SimpleFileBrowser.jar.meta → ...rowser/Android/SimpleFileBrowser.aar.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System.IO; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
public class SFBPostProcessBuild | ||
{ | ||
[InitializeOnLoadMethod] | ||
public static void ValidatePlugin() | ||
{ | ||
string jarPath = "Assets/Plugins/SimpleFileBrowser/Android/SimpleFileBrowser.jar"; | ||
if( File.Exists( jarPath ) ) | ||
{ | ||
Debug.Log( "Deleting obsolete " + jarPath ); | ||
AssetDatabase.DeleteAsset( jarPath ); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
Plugins/SimpleFileBrowser/Editor/SFBPostProcessBuild.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
Plugins/SimpleFileBrowser/Editor/SimpleFileBrowser.Editor.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "SimpleFileBrowser.Editor", | ||
"references": [], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
Plugins/SimpleFileBrowser/Editor/SimpleFileBrowser.Editor.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,24 @@ E-mail: [email protected] | |
1. ABOUT | ||
This plugin helps you show save/load dialogs during gameplay with its uGUI based file browser. | ||
|
||
2. HOW TO | ||
for Android: set Write Permission to External (SDCard) in Player Settings | ||
|
||
2. HOW TO | ||
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. | ||
|
||
3. SCRIPTING API | ||
|
||
3. FAQ | ||
- Can't show the file browser on Android, it says "java.lang.ClassNotFoundException: com.yasirkula.unity.FileBrowserPermissionReceiver" in Logcat | ||
If your project uses ProGuard, try adding the following line to ProGuard filters: -keep class com.yasirkula.unity.* { *; } | ||
|
||
- File browser doesn't show any files on Android 10+ | ||
File browser uses Storage Access Framework on these Android versions and users must first click the "Pick Folder" button in the quick links section | ||
|
||
- RequestPermission returns Permission.Denied on Android | ||
Declare the WRITE_EXTERNAL_STORAGE permission manually in your Plugins/Android/AndroidManifest.xml file as follows: <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/> | ||
You'll need to add the following attribute to the '<manifest ...>' element: xmlns:tools="http://schemas.android.com/tools" | ||
|
||
|
||
4. SCRIPTING API | ||
Please see the online documentation for a more in-depth documentation of the Scripting API: https://github.com/yasirkula/UnitySimpleFileBrowser | ||
|
||
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 | ||
|
@@ -20,16 +32,17 @@ NOTE: On Android Q (10) or later, it is impossible to work with File APIs. On th | |
using SimpleFileBrowser; | ||
|
||
public enum Permission { Denied = 0, Granted = 1, ShouldAsk = 2 }; | ||
public enum PickMode { Files = 0, Folders = 1, FilesAndFolders = 2 }; | ||
|
||
public delegate void OnSuccess( string path ); | ||
public delegate void OnCancel(); | ||
|
||
// Showing dialog | ||
bool ShowSaveDialog( OnSuccess onSuccess, OnCancel onCancel, bool folderMode = false, bool allowMultiSelection = false, string initialPath = null, string title = "Save", string saveButtonText = "Save" ); | ||
bool ShowLoadDialog( OnSuccess onSuccess, OnCancel onCancel, bool folderMode = false, bool allowMultiSelection = false, string initialPath = null, string title = "Load", string loadButtonText = "Select" ); | ||
bool ShowSaveDialog( OnSuccess onSuccess, OnCancel onCancel, PickMode pickMode, bool allowMultiSelection = false, string initialPath = null, string initialFilename = null, string title = "Save", string saveButtonText = "Save" ); | ||
bool ShowLoadDialog( OnSuccess onSuccess, OnCancel onCancel, PickMode pickMode, bool allowMultiSelection = false, string initialPath = null, string initialFilename = null, string title = "Load", string loadButtonText = "Select" ); | ||
|
||
IEnumerator WaitForSaveDialog( bool folderMode = false, bool allowMultiSelection = false, string initialPath = null, string title = "Save", string saveButtonText = "Save" ); | ||
IEnumerator WaitForLoadDialog( bool folderMode = false, bool allowMultiSelection = false, string initialPath = null, string title = "Load", string loadButtonText = "Select" ); | ||
IEnumerator WaitForSaveDialog( PickMode pickMode, bool allowMultiSelection = false, string initialPath = null, string initialFilename = null, string title = "Save", string saveButtonText = "Save" ); | ||
IEnumerator WaitForLoadDialog( PickMode pickMode, bool allowMultiSelection = false, string initialPath = null, string initialFilename = null, string title = "Load", string loadButtonText = "Select" ); | ||
|
||
// Force closing an open dialog | ||
void HideDialog( bool invokeCancelCallback = false ); | ||
|
Oops, something went wrong.