yasirkula / unitysimplefilebrowser Goto Github PK
View Code? Open in Web Editor NEWA uGUI based runtime file browser for Unity 3D (draggable and resizable)
License: MIT License
A uGUI based runtime file browser for Unity 3D (draggable and resizable)
License: MIT License
In the native Windows file dialog, if you type a full path in the filename input field instead of just a filename, it will follow the full path and open the file. But in the current version of SimpleFileBrowser, if you do this, the field just turns red and nothing happens. I think this feature would be very useful, because it allows the user to copy a file's full path on Windows Explorer (Shift+Right Click, Copy as path), paste it directly on SimpleFileBrowser, and press Enter to open it right away.
Example of expected behavior:
Load
dialog at some random directory, e.g. C:\
, with PickMode.Files
."C:\dir1\dir2\file.txt"
(with or without quotes) on the filename input field and press Enter or click Select.onSuccess
is invoked as usual.The native Windows dialog goes even further, and if you write a dir path, it changes the current dir to that dir, and it even accepts relative paths. But I imagine that's more effort. There's also the question of what the behavior should be for PickMode.Folders
, and FilesAndFolders
. I would already be very thankful just for absolute paths in the Load dialog for .Files
.
Description of the bug
In iOS, files are not showing as expected. Some folders are showing, but not regular folders like photos or users folder.
Also, it's possible to create a folder from the runtime, but it's not found in the iPhone default file browser.
Reproduction steps
Used the following code in a coroutine -
FileBrowser.SetFilters(true, new FileBrowser.Filter("Image", ".jpg", ".png", "public.image"), new FileBrowser.Filter("PDF", ".pdf"));
FileBrowser.SetDefaultFilter(".png");
yield return FileBrowser.WaitForLoadDialog(FileBrowser.PickMode.Files, false);
if (FileBrowser.Success)
{
string filePath = FileBrowser.Result[0];
Debug.Log("File Path - " + filePath);
//my codes here
}
Platform specs
Description of the bug
Browser is letting clicks through its frame as long as there is no UI element (like buttons, or the file-list-element). It happens that you accidentally click on buttons behind the browser.
Reproduction steps
Create a scene with a canvas. Add two buttons (one to open browser, one to check if it gets clicked through the browser).
Add sample script from github and change the start function to a public function to open the browser on click.
Platform specs
Is possible to change the aspect of the file picker? Like increase size to make it more readable on little screens
using the base code i can't pass from "yield return FileBrowser.WaitForLoadDialog( false, true, null, "Load File", "Load" );", not even the debug return a message, i'm using the version in the asset store
Hello! I have a little problem: on some computers file manager slows down and opens directories for a long time (even on computers with ssd), but on most others it works good(even on computers with hard drive)(windows). What could be the problem? Thank you in advance.
Hi,
How to access the FileBrowser instance to change transform,canvas, etc. at runtime?
I am trying to figure out if I can use a custom canvas instead of having to call ShowLoadDialog on Android 10. I have been developing an application for quite some time now and have been using this great browser on other platforms. In my app I set up a custom canvans to place the file browser window in a specific area on the screen. To open the file browser canvas I used to just activate and deactivate the Canvas GameObject during runtime and this still works on Windows Platforms. On Android 10 however, if i try to use my custom canvas, when I activate the gameobject I get no file listings and the quick links is blank. I tryid a simple test on Android by calling ShowLoadDialog instead of my custom canvas and the browser does give me the file listings and quick links shows primary drive. Is there a way to get the file listings to show up on Android 10 without having to call ShowLoadDialog as it works on Windows?
hey man, there is a way to show how much files exists in a folder?
The pack works fine in PlayMode but when i can't compile this project
The FileBrowser was working fine until a few days, but since a few commits the android filepath seems to be wrong:
content://com.android.externalstorage.documents/tree/primary%3ADCIM/document/primary%3ADCIM%2FScreenshots%2Fphoto.jpg
When I test in Unity 2019 and upload files via Windows everything seems to be fine. The path comes from the ShowLoadDialogCoroutine directly. It doubles the path for some reason. I did not change anything in the filebrowser i believe. Anyone had some similar issues?
Hello and thank you for the great tools!
I'm getting a random out of memory error from line 341 of FileBrowserHelpers.cs
return File.ReadAllBytes(sourcePath);
It appears it is called through me using if (FileBrowser.Success)
It happens randomly when loading audio files- file sizes from 1 megabyte to 50 megabytes will randomly get this error. The same audio file will randomly get the error if loaded in multiple times. Any idea on a direction for me to go to resolve this? Thank you for your time.
hey man, there is a way to show how much files exists in a folder?
I am getting the above error when using the example code provided. The exception is hit when running the yield return FileBrowser.WaitForLoadDialog(false, true, null, "Load File", "Load");
It is worth noting that the same works when I test on desktop, but when I build this and run on my Android phone (Note 10), it hits this error.
Can you please advise on what I could do to overcome this issue?
Description of the bug
Dear Sir,
I am using your "simple file browser" for my VR project. Actually, it's working well but there is something that I did not get it.
I can select the files from the list but i cannot click them. I can interact with all the buttons in my interface, but I cannot click the files in the file list. In addition, my oculus rift headset acting like a pointer when I'm on the file list panel. While I moving my head from up to down or vice versa I can select the files like my pointers.
Reproduction steps
-changing the canvas render mode "overlay to wordspace.
Platform specs
first of all thank you for this great plugin.
i have a problem and that is i want to pick a mp3 file from my local storage(from device) and then using audiosource i want to play it.
i have done this using this script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using UnityEngine.UI;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
using NAudio;
using NAudio.Wave;
using UnityEngine.Networking;
using SimpleFileBrowser;
public class ReadMp3 : MonoBehaviour
{
private AudioSource audioSource;
public Text pathText;
private void Start()
{
audioSource = GetComponent<AudioSource>();
}
public void ReadMp3Sounds()
{
FileBrowser.SetFilters(false, new FileBrowser.Filter("Sounds", ".mp3"));
FileBrowser.SetDefaultFilter(".mp3");
StartCoroutine(ShowLoadDialogCoroutine());
}
IEnumerator ShowLoadDialogCoroutine()
{
yield return FileBrowser.WaitForLoadDialog(false, null, "Select Sound", "Select");
pathText.text = FileBrowser.Result;
if (FileBrowser.Success)
{
byte[] SoundFile = FileBrowserHelpers.ReadBytesFromFile(FileBrowser.Result);
yield return SoundFile;
audioSource.clip = NAudioPlayer.FromMp3Data(SoundFile);
audioSource.Play();
}
}
}
in this script i used NAudio.dll file to accomplished it.
now my problem is that i successfully play audio song from my computer but when i build it for android all things worked properly(i could select mp3 from my android device),but the song was didn't played.
can you please tell me how can i do that for android or i made any mistake or something.
How to display images thumbnails instead of nice icons that exist now so the user can see what he is choosing from?
Hi,
I love your code and I used it for 5.6 but when I upgraded unity to the latest one, when I use your plugins it does not show all files in a folder. Because of that, the plugin is unusable.
Description of the bug
Filebrowser.cs(10,19): error CS0234: the type or namespace name 'InputSystem' does not exist in the namespace 'UnityEngine'.
Also happens in FileBrowserDeleteConfirmationPanel and FileBrowserRenamedItem.
Reproduction steps
I just downloaded and imported SimpleFileBrowser into my project. And it is generating these errors. I am using the latest InputSystem since I need to using some keypresses as input to my unity project.
Platform specs
Please provide the following info if this is a Unity 3D repository.
Additional info
NA
Thank you and have a nice day!
Normally It behaves in camera overlay and I want It to be in world Canvas.
Also there's some way to use it just to see files not load or save?
Thanks a lot for everything!
How to add default name when open dialog save file ?
Ths so much
Platform specs
At the moment I am trying to build a project including the file browser to UWP, but I get errors. I can not use Environment.SpecialFolder (and some more functionalities in this class) which seems to be not included in UWP. Maybe there is a quick fix. For today I will just try to include the UWP file browser. Of course it would be cool, if this file browser could do this too.
Is it possible to select either a file or a folder using the ShowLoadDialog? if i folder mode to true then I can't select a file even if I provide filters
Basically what it says, when I type in using SimpleFileBrowser it throws an error at me but only in VSCode.
I'm not sure whether the culprit is my phone or a bug in SimpleFileBrowser but I suspect the Android. I need help to be able to use the asset.
Android 9. At the start of the app I use CheckPermissions() which returns "Denied". I then use RequestPermissions() and re-check. It again says "Denied". Android app permissions says no permissions are requested.
The Load window left panel shows "Primary Drive" with the right one empty. Also tapping/double tapping "Primary Drive" does nothing. Still, an "up" button is present that when tapped twice it shows in the right panel: a numbered folder, "emulated", "enc_emulated" and "self". All are empty.
Android 10 Android app permissions says no permissions are allowed and no permissions are denied and CheckPermissions() returns "Denied" and after RequestPermissions() it's still "Denied". But after that, the Load window requested access to "Downloads" then to other locations as I browsed. These permissions are apparently saved from session to session but a new session start still shows "Denied".
How can I make it work on Android 9?
Hey. This is a fantastic plugin. Thanks a lot for making it.
I've been trying to get this to work all day. I get an access error every time i try to load a folder. Apologies in advance, it's probably super simple.
When I use
This method:
yield return FileBrowser.WaitForLoadDialog( FileBrowser.PickMode.FilesAndFolders, true, null, null, "Load Files and Folders", "Load" );
I get the following error when opening a folder:
UnauthorizedAccessException: Access to the path 'and insert path here' is denied;
I've tried using the folders only option, but it yields the same result.
I then tried using your other method
FileBrowser.ShowLoadDialog( ( paths ) => { Debug.Log( "Selected: " + paths[0] ); },
() => { Debug.Log( "Canceled" ); },
FileBrowser.PickMode.Folders, false, null, null, "Select Folder", "Select" );
But my issue here is that I can't figure out how to read paths[0] afterwards. I tried using OnSuccess but I have no idea how to get the value out of that either.
Hope you can help. An example would be great. Thanks in advance.
How do I scale it to occupy fullscreen?
Hello, first of all I love your asset and thank you for opensourcing it.
I think I discovered a little bug.
On Android, you need to ask for the READ_EXTERNAL_STORAGE
permission to access, for example, the content of an external SD card. But, in FileBrowser.cs L.492
, you call InitializeQuickLinks
in the Awake
function, before the user is asked for the permission to read files. Which means that the external SD card you may have, won't appear in the QuickLinks
of the SimpleFileBrowserCanvas
, even if the permission to access it has been given afterwards.
The bug is not blocking, since on all following app launches, if you don't revoke the permission of the app, you won't ever see it anymore. But it still would be better if it also worked the first time.
Sorry if stuipid quiestion, couldnt any platforms related info.
Thank you!
OS: Android 4.4.2
CPU: RK3288
I paste the sample codes, build the apk, and install it to my system.
Dialog shows, I can switch to every folder I want, but I can't see and files.
Is that a bug?
hi, is there any way to use this file browser for vr systems.
I tried some solutions,
-using a pointer instead of a mouse.
-changing the canvas render mode "overlay to wordspace."
in generally some of my applications work well, but "SimpleFileBrowserWindow" under the "SimpleFileBrowserCanvas" often cause problems.
First, thanks for this awesome Asset !
Would it require a lot of work to allow selecting multiple files in a folder and obtain list of paths ?
The file browser does not display any files or folders when opening a directory containing a system file (such as pagefile.sys in C:\). This only seems to happen in the IL2CPP build version, rather than the Mono version (or the editor).
I made this fix in FileBrowserHelpers.GetEntriesInDirectory
:
try
{
FileSystemInfo[] items = new DirectoryInfo(path).GetFileSystemInfos();
var entries = new List<FileSystemEntry>();
foreach (FileSystemInfo item in items)
{
try
{
if (!item.Attributes.HasFlag(FileAttributes.System))
entries.Add(new FileSystemEntry(item));
}
catch (System.Exception e) {
Debug.LogException(e);
}
}
return entries.ToArray();
}
catch (System.Exception e)
{
Debug.LogException(e);
return null;
}
What do you think?
It seems promising. I've heard many people said it is great. But for me, as long as I can not try some example scenes in this package, it's hard to me how to get started using it.
Hello,
Thank you for this support, this is pretty, but this can support browser file on PC for Webgl built.
Edit: I'll try and can not T.T
i'm having a little problem using this asset with oculus rift, the object SimpleFileBrowserItem in filesContainer does not response to my seted pointer, instead it responses to my main camera as a pointer (probably a problem with OnPointerEnter void, but i'm not sure)
i hope it can
The file path turns out to be empty when I select a file. The browser can access external directory's contents fine. I see all the files. But when I select them the path is empty. The same code works fine on Windows.
SimpleFileBrowser.FileBrowser.ShowLoadDialog( (path) => { uupdate(path); }, null, false, null, "Select File", "Select" );
It would be nice to optionally allow user to create a folder in current folder which the user could then select for return.
We have used this with great success in our Global Game Jam 2017 game Eye Can't Hear.
One question/feature request though: We want players to be able to add any supported audio file. As such, we'd like a filter to allow the player to select any file having one of the .mp3, .wav, .flac, .aiff, .ogg
extensions.
An 'any supported format' filter would be greatly appreciated.
Description of the bug
NullReferenceException: Object reference not set to an instance of an object
SimpleFileBrowser.RecycledListView.UpdateList () (at Assets/Plugins/SimpleFileBrowser/Scripts/SimpleRecycledListView/RecycledListView.cs:55)
SimpleFileBrowser.FileBrowser.RefreshFiles (System.Boolean pathChanged) (at Assets/Plugins/SimpleFileBrowser/Scripts/FileBrowser.cs:1420)
SimpleFileBrowser.FileBrowser.OnShowHiddenFilesToggleChanged () (at Assets/Plugins/SimpleFileBrowser/Scripts/FileBrowser.cs:1071)
UnityEngine.Events.InvokableCall.Invoke () (at <4eca0aa85b9643a199169bb7e91fc8d3>:0)
UnityEngine.Events.UnityEvent`1[T0].Invoke (T0 arg0) (at <4eca0aa85b9643a199169bb7e91fc8d3>:0)
UnityEngine.UI.Toggle.Rebuild (UnityEngine.UI.CanvasUpdate executing) (at D:/unity/2019.4.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Toggle.cs:130)
UnityEngine.UI.CanvasUpdateRegistry.PerformUpdate () (at D:/unity/2019.4.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/CanvasUpdateRegistry.cs:177)
UnityEngine.UI.ScrollRect:LateUpdate() (at D:/unity/2019.4.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/ScrollRect.cs:805)
Reproduction steps
FileBrowser.ShowLoadDialog((paths => {
//todo
}), () => {
//todo
});
Platform specs
Please provide the following info if this is a Unity 3D repository.
Additional info
Please check Logcat (Android) or Xcode console (iOS) for any meaningful error messages and include them here.
When calling ShowLoadDialog
or ShowSaveDialog
inside one of the callback functions to open a new dialog after the first one was closed, the OnOperationSuccessful
or OnOperationCanceled
method immediately sets the onSucess
and onCancel
members to null:
private void OnOperationCanceled( bool invokeCancelCallback )
{
Success = false;
Result = null;
Hide();
if( invokeCancelCallback && onCancel != null )
onCancel(); // **Open new dialog here**
onSuccess = null; // **It breaks because the callbacks are set to null**
onCancel = null;
}
Removing the last two lines of the method would allow "chaining" of dialogs.
Hey,
There are instructions about how to edit the .aar bundle to remove a line from AndroidManifest, but none about how to re-wrap it; neither 7-zip nor WinRar offer this archiving format.
如果标题栏的路径很长,启动时设置默认路径,那么窗口显示时会隐藏后面的路径,这种体验感并不友好,我修改了下脚本解决了这个问题
pathInputField.text = m_currentPath;
pathInputField.ActivateInputField();
pathInputField.Select();
StartCoroutine(MoveTextEnd_NextFrame());
IEnumerator MoveTextEnd_NextFrame()
{
yield return new WaitForEndOfFrame() ;
pathInputField.MoveTextEnd(false);
}
Does the current package handle save file override confirmation? I see that the prefab has a delete confirmation panel, it would be nice to have a save file override confirmation panel too. Currently it's hard to check before saving since I can only get file paths when OnSuccess happens.
Thanks for your great asset!!
Following your code example on github, I got it working instantly. Only one question. After loading a file, Unity complains that there are two EventSystems in the scene.
How can I get rid of it? I have a Canvas and a UI and already an EventSytem in place.
Description of the bug
We have updated to version 1.4.7 but, for some reason, we are getting an error saying we have duplicate classes on "com.yarsikula.unity.FileBrowserPermissionReceiver" and "com.yarsikula.unity.FileBrowserPermissionFragment" found in modules SimpleFileBrowser.jar and Classes.jar.
Is there a way to fix this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.