Search Unity

File Browser - Native file browser

Discussion in 'Assets and Asset Store' started by Stefan-Laubenberger, Dec 28, 2017.

  1. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hello again

    We removed the support for Linux in the free version in September 2019 and the asset itself from the store in November 2019.
    Therefore, if you like to have a working version for Linux, please consider buying the PRO version.


    Cheers
    Stefan
     
  2. finoldigital

    finoldigital

    Joined:
    Dec 1, 2018
    Posts:
    2
    How do we actually read the file that the user has selected on UWP?

    I have the File Browser appearing fine, and I can read the file OK in the Editor or the Standalone build, but I get FileNotFoundException if I try to read the file in a UWP build.

    I'm assuming this error is actually due to sand-boxing/permissions, so I tried adding the PicturesLibrary capability through the Publishing Settings in the Player Settings for UWP. Adding the capability actually causes the Windows File Explorer to have a link to the Pictures Library in the left panel (great!), but I still get the FileNotFoundException even if I select an image using that (not so great).

    Do you have any suggestion for what to do?
    I'm on the latest PRO-version of your asset and on Unity 2018.4.16f1.

    Edit: I should mention I'm using System.IO.File. Maybe there is a way to use Windows.Storage.StorageFile that I'm not seeing?
     
    Last edited: Feb 7, 2020
  3. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    WSA is a pain :(
    However, we expanded the File Browser to return a StorageFile which you then can read and write:
    Code (CSharp):
    1. #if ENABLE_WINMD_SUPPORT
    2. public async void ReadFile()
    3. {
    4.     FileBrowser.OpenSingleFile();
    5.     var file = FileBrowserWSAImpl.LastOpenFile;
    6.     var lines = await FileIO.ReadLinesAsync(file);
    7. }
    8. #endif
    To gain access to the latest version, please send me your invoice via email.


    Cheers
    Stefan
     
    Last edited: Feb 8, 2020
  4. finoldigital

    finoldigital

    Joined:
    Dec 1, 2018
    Posts:
    2
    Your update works great; thanks for your prompt response!
     
    Stefan-Laubenberger likes this.
  5. VideoJames

    VideoJames

    Joined:
    Aug 23, 2012
    Posts:
    10
    Hi Stefan,

    We purchased FileBrowser yesterday in order to open folder locations asyncronously on Windows, but there doesn't seem to be any way to do that.

    Using OpenFoldersAsync (with multiSelect set to false) gives this warning
    Code (CSharp):
    1. 'OpenFoldersAsync' is running synchronously in the Editor and Unity builds newer than 2018.4
    Then runs the synchronous version of OpenFolders

    Using our own thread

    Code (CSharp):
    1. string receivedFilesFolder = "";
    2.         Thread t = new Thread(() =>
    3.         {
    4.             try
    5.             {              
    6.                 openingFolder = true;
    7.                 Debug.LogError("STARTING THREAD");
    8.                 var path = FileBrowser.OpenSingleFolder("Select Briefcase Folder", receivedFilesFolder);
    9.                 Debug.LogError("FINISHING THREAD");
    10.                 openingFolder = false;              
    11.                 callback.Invoke(path);
    12.             }
    13.             catch (Exception e)
    14.             {
    15.                 Debug.LogError(e);
    16.             }
    17.         });
    18.         t.Start();
    Only gets as far as Logging "Starting Thread". The FileBrowser doesn't open at this point, but does have control of the thread preventing it from closing.

    Some more notes
    • OpenSingleFolder works synchronously
    • SaveFileAsync works fine
     
    Last edited: Feb 12, 2020
  6. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    Please comment line 154 in "FileBrowserWindows.cs".
    After that, async will work :)
    We will improve that in the next version.


    Cheers
    Stefan
     
  7. VideoJames

    VideoJames

    Joined:
    Aug 23, 2012
    Posts:
    10
    Thanks Stefan :)

    One more thing. On macOS we can select a file using OpenFileAsync in the Editor, but not in a build. Are there mac specific permissions that need to be changed?
     
    Last edited: Feb 14, 2020
  8. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Does the dialog show up?
     
  9. VideoJames

    VideoJames

    Joined:
    Aug 23, 2012
    Posts:
    10
    My bad that wasn't very clear.

    The dialog shows up, but in the build files are greyed out and cannot be selected. In the editor those same file can be selected.
     
  10. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    What happens if you change the file extension inside the dialog (or just re-select it)?
     
  11. VideoJames

    VideoJames

    Joined:
    Aug 23, 2012
    Posts:
    10
    Aha! There's only one extension option All Files and re-selecting it makes us able to select files.

    We've tested specifying other extensions and these work immediately, just not * for all extension types, which is unfortunately what we need.
     
    Last edited: Feb 16, 2020
  12. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Good news, we found a fix for that use-case :)

    Please send us your invoice and we will give you access to the fixed version.
     
    Last edited: Feb 17, 2020
  13. somosky

    somosky

    Joined:
    Feb 15, 2014
    Posts:
    138
    Hi I was thinking about picking up your asset today and had a few questions.

    1: Can you create files with this? Not just save and load? So I guess maybe a save as option. Just trying to create Txt files.

    2: Is there some sort method called when the player saves or loads a file? Example FileSaved() or FileLoaded()

    3: I'm assuming this will be capable of loading a txt file which I'll be able to pull my json file from and populate the information I need in my scene.
     
    Last edited: Feb 17, 2020
  14. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    File Browser doesn't read or write files; it only selects them in the native OS dialogues.
    However, you get a string (=full path) from the methods which can be used to read or write files.

    Here are two examples:

    Read a text file:
    Code (CSharp):
    1. string path = FileBrowser.OpenSingleFile("txt");
    2.  
    3. string text = System.IO.File.ReadAllText(path);
    4. Debug.Log(text);
    Write a text file:
    Code (CSharp):
    1. string path = FileBrowser.SaveFile("MySaveFile", "txt");
    2.  
    3. string text = "Hello, this is a test!";
    4. System.IO.File.WriteAllText(path, text);
    I hope this helps you further.


    Cheers
    Stefan
     
  15. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    The new version is in the store!

    @KenneyWings we discussed your issue with the "reminder" and we decided to remove the "ReminderCheck".
    We left the new year greeting, since many users enjoy it, like this tweet demonstrates: https://twitter.com/HellsPlumber/status/1212545165962960896?s=20
    I hope you like the new version and it would be nice, if you could update your review accordingly.
     
  16. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    Hey Stefan, thanks! I appreciate the removal, I've updated the review accordingly.
     
  17. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Thank you for your updated review!

    Btw. the code to send anonymous data was removed some time ago, so it's not "turned off by default"; it's simply no longer possible. ;)
     
  18. honzadrastik

    honzadrastik

    Joined:
    Dec 4, 2016
    Posts:
    5
    Hello,

    is there any option, how to use it in WebGL? Because I didn't read in Features, if I can use for WebGL

    Thanks.
     
  19. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    We're working on a solution for WebGL, but I can't give you an ETA.
    Currently, FB works "only" on all standalone platforms.

    Stay safe!


    Cheers
    Stefan
     
    MNNoxMortem likes this.
  20. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
  21. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Is it compatible with 2018.4LTS?
     
  22. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Sure, all our assets are compatible from Unity 2017.4 - 2020.
     
    AlanMattano likes this.
  23. FSpark

    FSpark

    Joined:
    Mar 4, 2015
    Posts:
    5
    Hi Stefan,
    Firstly great plugin and works really well on Windows standalone and Mac OS builds!

    One request - would it be possible to separate out all the non-essential assets (images, scripts, demo, update check etc) from the bare minimum essential assets such that on importing or post-importing it is easy to delete all non-core assets? When building the final executable, we would prefer not to have any unnecessary assets in our production builds.
    Thanks!
     
  24. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi FSpark

    The "Common"-folder is the base for all our assets and we need the scripts and resources for the demos and so on.
    But you can safely delete the yellow marked folders:
    upload_2020-6-8_17-19-55.png

    We move all images to the "Editor Default Resources"-folder and so they don't end up in the build.

    I hope this helps you further.


    Cheers
    Stefan
     
    MNNoxMortem and AlanMattano like this.
  25. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    what are the pro and cons of passing from free vr to pay version?
    I have both but my bad code is fragile and I'm afraid.
     
  26. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi Alan

    There are the main positive points:
    1. Works with IL2CPP on all four platforms
    2. Support for Linux
    3. Support for UWP
    4. Support and updates for the asset ;)
    The API is compatible with the deprecated free version, so you shouldn't run into any troubles.

    We recommend this steps for an upgrade:
    1. Update "File Browser PRO" to the latest version from the "Unity AssetStore"
    2. In Unity, go to menu "File" => "New Scene"
    3. Delete the folder "Assets/Plugins/crosstales"
    4. Import the latest version from the "Unity AssetStore"
    That's it! If you run into any issues, just contact us.


    Cheers
    Stefan
     
    AlanMattano likes this.
  27. manish_am

    manish_am

    Joined:
    May 11, 2020
    Posts:
    1
    I am using latest version of the asset , everything works fine on Mac but when i build for UWP , I get an error "could not find the part of path <complete path>" .
    I am trying to read image from Windows mobile and standalone devices , everything works fine Browser Window opens , I get the path of the file after this error come "could not find the part of path <complete path>".
    Please Help.
     
  28. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    Please see chapter 4.6 in the documentation:
    https://www.crosstales.com/media/data/assets/FileBrowser/FileBrowser-doc.pdf

    I hope this helps you further.


    Cheers
    Stefan
     
  29. Zaeran

    Zaeran

    Joined:
    Dec 14, 2012
    Posts:
    12
    Hey there!

    Currently using v2020.2.8 on Unity 2018.3.14f1.

    Whenever I try to use FileBrowser.OpenFiles() or FileBrowser.OpenFilesAsync(), if I have multiple files selected it will return the folder I'm currently in rather than the selected files. This behaviour is also happening in the provided demo scenes.
    Selecting a single file with either function works as intended.

    The previous update works as intended
     
    Last edited: Jul 4, 2020
  30. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    Yes, you're right, the current version has exactly the bug you described.
    This is fixed in the soon-to-be released version 2020.3.0.
    Please send us your invoice and we will give you access to the fixed version.


    So long,
    Stefan
     
  31. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Will this asset contain the dll recompile for ARM?
     
  32. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hmm, what exactly do you mean? 2020.3.0 doesn't contain any dlls :)
     
  33. Mese96

    Mese96

    Joined:
    Jul 23, 2013
    Posts:
    40
    Hey, is there any way to get an dialog which allows the user to select either a file or a folder ?
     
  34. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    No, all native OS dialogues offer either an option for files or folders.


    Cheers
    Stefan
     
  35. RIPANN

    RIPANN

    Joined:
    Aug 9, 2017
    Posts:
    9
    Hi Stefan!

    How do I filter by multiple extension types using the FileBrowser.OpenSingleFile() for selecting audio files?

    I need this so that the user will be able to select a single audio file from the file browser, but the file types may be different like mp3, wav or ogg.

    Cheers,
    Ripan
     
  36. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi Ripan

    There are two ways:
    Code (CSharp):
    1. //Option 1
    2. string path = FileBrowser.OpenSingleFile("Open single file", null, new ExtensionFilter("Sound Files", "mp3", "ogg", "wav"));
    3.  
    4. //Option 2
    5. string path = FileBrowser.OpenSingleFile("Open single file", null, "mp3", "ogg", "wav");
    I hope this helps you further.


    Cheers
    Stefan
     
  37. oukaitou

    oukaitou

    Joined:
    Jan 10, 2014
    Posts:
    18
    Hello

    I want to open folder with this style, however it only work in Unity Editor, not work in standalone. How can I solve it? Thanks

    TIM截图20200721225344.png
     
  38. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi

    Thank you for using our product!

    The dialog you see in the current version is the official Windows "Folder Dialog"; the one you posted is from Unity and basically misuses the "File Dialog" to select folders.
    Since we use the correct native implementation, I don't see a reason why we should make it worse by using the inappropriate dialog. ;)

    I hope you understand our point of view.

    Stay safe!


    Cheers
    Stefan
     
  39. oukaitou

    oukaitou

    Joined:
    Jan 10, 2014
    Posts:
    18
    1. I used UnityStandaloneFileBrowser before, and it uses the same style as the Unity Editor shown
    2. I can paste the path to quickly jump to the right folder, or search the folder easily, they are not allowed in the "Folder Dialog"

    So I hope you can consider to give us an option to use the "File Dialog" to select folders. Thank you
     
    Last edited: Jul 21, 2020
  40. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    "UnityStandaloneFileBrowser" uses DLLs, which can cause trouble with IL2CPP and newer Unity versions.
    On the other hand File Browser PRO uses native calls and works flawlessly with IL2CPP and Unity, but the trade-off is that it's limited to the (Mono) restricted api/tools. E.g. we worked on a solution, but "ComImport" didn't work as expected. Therefore, we had to use the native implementations available under Windows.

    Believe, me I'm not a fan of the tree-view folder browser, but that's what you get if you go "native" and have to use "shell32" etc.

    However, we will give our research another try, but I can't promise anything.
     
  41. oukaitou

    oukaitou

    Joined:
    Jan 10, 2014
    Posts:
    18
    Thank you for the explanation.
     
    Stefan-Laubenberger likes this.
  42. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hello again

    Good news! We found a native solution:
    upload_2020-7-24_9-37-28.png

    The only downside is, that it needs IL2CPP to work.

    If you like to try it, please send us the invoice via email.


    Cheers
    Stefan
     
  43. oukaitou

    oukaitou

    Joined:
    Jan 10, 2014
    Posts:
    18
    Hello, so it does not support mono backend?

    I'd like to try but sadly my project is not ready for IL2CPP yet.

    Thank you for the quick response, I will definitely try it once the project is ready for IL2CPP.
     
  44. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Only IL2CPP is supported; the new dialog doesn't work under Mono.
     
  45. Archtica

    Archtica

    Joined:
    Mar 23, 2018
    Posts:
    47
    Hello Stefan

    EDIT:
    I can see by going back in the forum that others have had the same issue, so I'll go through their solutions first and maybe return :)

    Thank you for a great product. I'm very happy with it.
    I'm however having a hard time getting a MacOS app validated for the app store connect
    Following your recommendations I code signed the bundle myself following your pdf. "Disable Library Validation" in the entitlements didn't do it for me. It complained about the bundle not being signed at all even with the setting on.

    I've now gotten as far as uploading to the store, but at the very end I get a message saying:
    ITMS-90511: CFBundleIdentifier Collision - The Info.plist CFBundleIdentifier value 'com.crosstales.fb.macOS' of 'MYAPP.app/Contents/PlugIns/FileBrowser.bundle' is already in use by another application.
    How do I get around this. Do I just rename the CFBundleIdentifier of your bundle to my app identifier or come up with something myself?

    From unity i create an xcode project and the app is uploaded with:
    Sandbox enabled: User defined files read/write (to be allowed to use your plugin)
    Hardened runtime: Disable Library Validation (just in case)

    Thank you very much!
     
    Last edited: Aug 14, 2020
    Stefan-Laubenberger likes this.
  46. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    Hi just got this and on windows (Unity 2018.4, mono) it randomly gives an error on closing the save dialog (unity error - seen in log in my own project, not demo one)
    "An abnormal situation has occurred: the PlayerLoop internal function has been called recursively. Please contact Customer Support with a sample project so that we can reproduce the problem and troubleshoot it."

    Edit: Not the only one to see such an error on non-async UnityStandaloneFileBrowser-related code: https://forum.unity.com/threads/pla...acos-file-browser-dialog.791538/#post-5266125
     
    Last edited: Aug 19, 2020
  47. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hi andyz

    Our tool uses a different implementation than the one in the url.
    Anyway, is this happening in the Editor or in builds?
    What's your exact version of Unity and our asset?

    So long,
    Stefan
     
  48. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    In windows 64 builds (mono). Ok I am trying to find a minimal repro as not happening yet with demo, just large project. Unity 2018.4.25, latest file browser pro
     
  49. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,276
    Hi Stefan it is repeatable in your demo (sync) scene under a certain setup, if you turn off v-sync in quality settings and set the Application.targetFrameRate in script down to say 15. You quite easily have the error appear in the log after opening & closing the save dialog a few times - click the app window and move it in between.

    The reasons for setting an Application.targetFrameRate can be to save laptop power/GPU usage in some apps

    It may be a harmless error but we flag up such errors in a dialog as they generally do not happen
     
    Last edited: Aug 20, 2020
  50. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,981
    Hello again

    Thank you for your details about the issue!

    We will try to repeat your steps and improve FB if possible.
    Meanwhile, have you tried using the async-methods?


    So long
    Stefan