GithubHelp home page GithubHelp logo

Comments (15)

yasirkula avatar yasirkula commented on August 11, 2024

You can call ShowLoadDialog after activating your own Canvas GameObject. Calling ShowLoadDialog is inevitable. This working fine on Windows must be a minor bug.

from unitysimplefilebrowser.

astaikos316 avatar astaikos316 commented on August 11, 2024

filebrowser
As shown in the attached, I customized the prefab for some specific functionality and use it as a GameObject window that I SetActive when the window is required. I do not have to run ShowLoadDialog explicitly on windows to give me the file listings. When I try to run it the same way on Android, my quick inks and file list is blank. No errors in debug in Android Studio. If i deactivate this custom gameobject and just run showloaddialog, i get the default Prefab Canvas come up and the file list is shown. Is there something i am not understanding?

from unitysimplefilebrowser.

yasirkula avatar yasirkula commented on August 11, 2024

You must show the file dialog as follows, there is no workaround for it:

yourCustomFileBrowserCanvas.gameObject.SetActive(true);
FileBrowser.ShowLoadDialog(somethingsomething);

As I said, the behaviour on Windows must be a bug, the browser has to be shown with ShowLoadDialog. FileBrowser will use your canvas when ShowLoadDialog is called if your dialog is active in the scene at that time.

from unitysimplefilebrowser.

astaikos316 avatar astaikos316 commented on August 11, 2024

Ok i think I understand a little more now. Since I am using some custom buttons, i am not sure what the ShowLoadDialog funtion options should be. Can you provide any insight there?

from unitysimplefilebrowser.

yasirkula avatar yasirkula commented on August 11, 2024

You can pass null to onSuccess and onCancel parameters.

from unitysimplefilebrowser.

astaikos316 avatar astaikos316 commented on August 11, 2024

Do I have to pass anything to the title and button text options or can I leave those out or null?

from unitysimplefilebrowser.

yasirkula avatar yasirkula commented on August 11, 2024

You need to pass the same title and button text or your changes will be overridden. You can modify FileBrowser.cs to ignore those parameters, if you wish. Don't hesitate give it a shot.

from unitysimplefilebrowser.

astaikos316 avatar astaikos316 commented on August 11, 2024

You must show the file dialog as follows, there is no workaround for it:

yourCustomFileBrowserCanvas.gameObject.SetActive(true);
FileBrowser.ShowLoadDialog(somethingsomething);

As I said, the behaviour on Windows must be a bug, the browser has to be shown with ShowLoadDialog. FileBrowser will use your canvas when ShowLoadDialog is called if your dialog is active in the scene at that time.

I have tried this, however when I build out to Android and run it on the device, my filebrowser window continues to show empty.

from unitysimplefilebrowser.

yasirkula avatar yasirkula commented on August 11, 2024

Does the Browse... button not show up in quick links section? What are the error messages in logcat?

from unitysimplefilebrowser.

astaikos316 avatar astaikos316 commented on August 11, 2024

I was able to figure out the issue. There was an issue with upgrading the overall project to the latest version. I am able to open and browse on Android now. However, I need to be able to create directories in C# and write files to them. It is not clear how to use FileBrowserHelpers.CreateFolderInDirectory( string directoryPath, string folderName ) function call as I do not know what the directoryPath variable should be.

from unitysimplefilebrowser.

yasirkula avatar yasirkula commented on August 11, 2024

It is the path returned by FileBrowser.ShowLoadDialog when pickMode is set to Folders. If it is set to Files and you'd like to create a folder in the selected file's parent directory, you'd first have to get that parent directory's path via FileBrowserHelpers.GetDirectoryName.

from unitysimplefilebrowser.

astaikos316 avatar astaikos316 commented on August 11, 2024

Is there a way with getting a directory listing in c# without interacting with the GUI?

from unitysimplefilebrowser.

yasirkula avatar yasirkula commented on August 11, 2024

Without interacting with the GUI, only persistentDataPath and temporaryCachePath directories can be queried. Storage Access Framework requires us to explicitly ask the user for permission to browse a folder's contents. Hence you see the "Browse..." button in the file browser on Android 10+.

Even if the user had granted permission for e.g. /mnt/0/DCIM folder, you still can't get the files inside it using that raw path. You need the SAF path returned by the file browser. But, if you cache the picked directory's SAF path, later on you can access this directory without interacting with the GUI using that SAF path (as long as the user doesn't delete that directory).

from unitysimplefilebrowser.

astaikos316 avatar astaikos316 commented on August 11, 2024

I actually do not get the "Browse..." button in the fie browser. I see Primary Drive in the quick links section and the folder list when opening the browser.

from unitysimplefilebrowser.

yasirkula avatar yasirkula commented on August 11, 2024

In that case, you can use C#'s File/Directory API on that device. On Android 11+, always Storage Access Framework is used so my previous message applies to those devices.

from unitysimplefilebrowser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.