Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

File Browser - Native file browser

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

  1. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,251
    Yes, using the async with the app not set to run in the background is kind of the same and appears to work fine without that issue!
    I'm curious on the async though - why there seemed to be no info in the intro documentation and why the deprecation of the calls that pass in a delegate, which seems the sensible way to do it if you have file browser calls in different parts of your app?
     
  2. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    We will add a detailed description of the async-methods in the next update of the documentation.
    However, initially, we thought it's a good idea to pass the delegate to the function, but we realised, it's easier for most customers to just subscribe to the callbacks of FB.
     
  3. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    Hey Stefan, have you considered adding other dialogs too? I tried finding a plug-in to do this but couldn't find a proper one in the store, there's one but it seems broken according to reviews. Would be great to have standard "OK" message boxes or even "Yes/No/Cancel" etc. boxes.
     
  4. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi Kenney

    We thought about it and we haven't found a conclusion ;)
    The main problem is this: we like to support all desktop OS with our assets, but dialogs outside of Windows are a big pain...
    This means it should become a separate Windows-only asset.
    However, I can't promise anything atm since we're really busy with upgrading our existing assets.


    So long,
    Stefan
     
  5. YuuYuuV

    YuuYuuV

    Joined:
    Oct 7, 2019
    Posts:
    6
    Hello,

    I tried running the example code below on UWP on Unity2019.2 and got an error "The name 'FileBrowserWSAImpl' does not exist in the current context.".

    Please let me know if there are any mistake.
    Any advice would be appreciated.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Crosstales.FB;
    5. using Crosstales.FB.Wrapper;
    6.  
    7. public class TestScript : MonoBehaviour
    8. {
    9.  
    10. #if ENABLE_WINMD_SUPPORT
    11.     public async void ReadFile()
    12.     {
    13.         FileBrowserWSAImpl.CurrentLocation = PickerLocationId.DocumentsLibrary;
    14.         FileBrowserWSAImpl.CurrentViewMode = PickerViewMode.Thumbnail;
    15.         FileBrowser.OpenSingleFile("txt");
    16.         var file = FileBrowserWSAImpl.LastOpenFile;
    17.         var lines = await FileIO.ReadLinesAsync(file);
    18.         //do something with the content
    19.     }
    20. #endif
    21. }
     
  6. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I think your compile define should look like this:
    #if (UNITY_WSA && !UNITY_EDITOR) && ENABLE_WINMD_SUPPORT

    Does that help?


    Cheers
    Stefan


    Edit:
    We updated the example in the documentation to use the compile define showed above.
     
    Last edited: Aug 30, 2020
  7. YuuYuuV

    YuuYuuV

    Joined:
    Oct 7, 2019
    Posts:
    6

    Thank you.
    I tried it but it doesn't change.

    'FileBrowserImpl' file and 'FileBrowserWSA' file are exist.
    I guess the class is not referenced for some reason, but I don't know in detail.
    Are UWP related scripts recently maintained?
     
  8. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Yes, the UWP-files are maintained and used in many actual projects from our customers.
    Therefore, everything should work.

    However, you can't access the scripts inside the Editor - the classes only work in builds. Have you tried creating a UWP-build?
     
  9. YuuYuuV

    YuuYuuV

    Joined:
    Oct 7, 2019
    Posts:
    6
    Oh I got it.
    There are errors on VS, but no error on Editor. I ran build and it worked fine with no errors.
    Thank you!
     
    Stefan-Laubenberger likes this.
  10. jed_unity855

    jed_unity855

    Joined:
    Sep 1, 2020
    Posts:
    2
    Hello! I have pro, and have realized that I can't properly change the dialog title. It always reads "Browser For Folder". Anyone else have this problem?

    Ex.
    FileBrowser.OpenSingleFolder("Howdy partner", _currentDir);

    The browser always opens to the correct place, but the title seems unaffected.
     
  11. Stefan-Laubenberger

    Stefan-Laubenberger

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

    That's true, it's not possible to overwrite the standard text under Windows.
    If you enable "Debug" in the configuration, you would see this warnings:
    upload_2020-9-2_1-2-45.png

    Cheers
    Stefan
     
  12. jed_unity855

    jed_unity855

    Joined:
    Sep 1, 2020
    Posts:
    2
    thanks for the rapid response :)
     
    Stefan-Laubenberger likes this.
  13. gamefox87

    gamefox87

    Joined:
    Aug 19, 2016
    Posts:
    64
    Hi @Stefan-Laubenberger ,

    Does this work on Windows x86 or only x64?

    Also is there any mobile compatibility with android or iOS file systems?
     
  14. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Thank you for your interest in File Browser!

    Our asset works with all standalone build platforms, including Windows x86.

    FB currently doesn't support mobile, but an integration for mobile, at least Android, is planned but I can't give you an ETA.

    Have a nice weekend and stay safe!


    Cheers
    Stefan
     
    gamefox87 likes this.
  15. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
    Hi Stefan,
    I'm having a lot of issues trying to add an asmdef to the asset. By any chance have you previously attempted this and if so did you encounter any issues? We use a tonne of asmdef's so I'm fairly used to dealing with the issues that come up but struggling in this case. 2020.1.10f1 with latest File Browser version. Many thanks.
     
  16. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi Timboc

    We used asmdefs and always created one under "Assets/Plugins/crosstales".
    Doesn't that work for you?


    So long,
    Stefan
     
  17. Timboc

    Timboc

    Joined:
    Jun 22, 2015
    Posts:
    238
    Hi Stefan,
    Thanks for your prompt reply. It appears to work at first but then there's a warning:
    Assembly for Assembly Definition File '../crosstales/com.crosstales.asmdef' will not be compiled, because it has no scripts associated with it.
    (Which is odd because... there should be a bunch of scripts in the subdirs that are associated with it)
    And then when I add the asmdef as a reference, the Crosstales namespace isn't available either. I'm still under the assumption that this is a project specific issue and I'm about to try a library rebuild. I'm not having any issues with any other third party assets so that's why I thought I'd double check if you had previously seen issues. Many thanks. Tim
    [Edit: Yup, full Library rebuild fixed it - sorry for any inconvenience!]
     
    Last edited: Nov 3, 2020
    Stefan-Laubenberger likes this.
  18. rdialuce

    rdialuce

    Joined:
    Nov 24, 2017
    Posts:
    2
    Hello Stefan
    Is there a way to use in FileBrowser.OpenFiles()
    or int FileBrowser.OpenSingleFile() in addition to the
    directory name also the default file name?
    Something similar to FileBrowser.SaveFile().
    Thank you
     
  19. Stefan-Laubenberger

    Stefan-Laubenberger

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

    It's possible under Windows, but we haven't exposed the functionality yet.
    Would that be good enough?


    Cheers
    Stefan
     
  20. rdialuce

    rdialuce

    Joined:
    Nov 24, 2017
    Posts:
    2
    would be great. i need it on windows.
    Thank you.
     
  21. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Please send us your invoice and you will get access to the latest version.


    Cheers
    Stefan
     
  22. maart

    maart

    Joined:
    Aug 3, 2010
    Posts:
    82
    Is there a way of reading the content of a folder like *.* and dump all the filenames in an array?
     
  23. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Yes, you can use the following methods:
    • FileBrowser.Instance.GetFiles()
    • FileBrowser.Instance.GetDirectories()
    • FileBrowser.Instance.GetDrives()
    I hope this helps you further.


    Cheers
    Stefan
     
  24. Stefan-Laubenberger

    Stefan-Laubenberger

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

    We also created new demo build tho show the new implementation for Runtime File Browser:
    RTFB.png


    @rdialuce the new version contains your requested feature :)
     
  25. megavoid-de

    megavoid-de

    Joined:
    Sep 29, 2020
    Posts:
    8
    Hi Stefan,

    I have just updated our project to version 2020.5.2. The reason was a bug found using an older version that has not been resolved in the newest version either.

    We have compiled our project today using Unity 2020.2.b14 on macOS 11 Big Sur as a Universal Binary for Intel Macs and Apple M1.
    When running on a M1 MacBook with the M1 Binary the FileBrowser PRO dialogs do not work. Running the Build in Rosetta 2 (Intel compatibility mode) the dialogs work as expected.
    In the Unity Editor everything is running fine as well.

    We are using the FileBrowser.Instance.SaveFile() and FileBrowser.Instance.OpenSingleFile() functions.
     
  26. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Unfortunately, we don't own a M1 Mac, so we can't verify the bug. :(
    However, the source code is under "Libraries/macOS" inside the asset. Therefore it should be possible to create a XCode-project and rebuild the library for M1 (and Intel?).

    I hope this helps you further.


    Cheers
    Stefan
     
  27. megavoid-de

    megavoid-de

    Joined:
    Sep 29, 2020
    Posts:
    8
    Hi Stefan,

    as we are still early in development the issue is not really pressing for us, just wanted to report the bug. We guessed that this problem may not have shown up by now as M1 hardware is still rare.

    Cheers,
    Danny
     
  28. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    Hey! Got a small problem, when doing;

    Code (CSharp):
    1. FileBrowser.Instance.SaveFile("Save map pack", Application.persistentDataPath, mapPack.title, new ExtensionFilter("Map pack", "mappack"));
    It doesn't actually open the save dialog in the Application.persistentDataPath path but goes to the desktop (as per default?)
     
  29. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    The Windows dialog saves the last chosen directory - it only sets it for the first time per application version and is ignored afterwards.
    Unfortunately, this behaviour isn't changeable.
     
  30. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    Ah that's a shame! Thanks for the reply.
     
  31. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    It can be prevented by using the Runtime File Browser package together with FB ;)
     
  32. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    We've just released version 2020.5.4 of File Browser.
    Main changes:
    • Planned final release for 2020
    • Code-cleanup
    • New Youtube video added:
    • Updated to Common 2020.4.7
     
  33. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,251
    Hi I wanted to sign my app in xcode for Mac, to distribute to testers, by exporting my Unity build as an xcode project and doing so there.
    But... the crosstales Filebrowser bundle is unsigned and so the project will not build in xcode.
    Any tip to sign the bundle? Should bundles be provided pre-signed?
     
  34. Stefan-Laubenberger

    Stefan-Laubenberger

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

    You have to sign it after the build, please see chapter 8.1 of the documentation:
    https://www.crosstales.com/media/data/assets/FileBrowser/FileBrowser-doc.pdf


    Cheers
    Stefan
     
  35. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,251
  36. andyz

    andyz

    Joined:
    Jan 5, 2010
    Posts:
    2,251
    Hi Stefan so I tried signing the whole app and signing the bundle after that but when I verify the app it just complains about all the bundles and dylibs in the mac app including filebrowser. Do you have any problems or tips on this?! Unity 2019 LTS
     
  37. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Have you signed only our bundle or the whole app?

    Maybe it's faster and easier to discuss this via email or Discord.
     
  38. Vic070

    Vic070

    Joined:
    Aug 6, 2016
    Posts:
    9
    On version 2021.1.0, "OpenFiles" won't let me select multiple files, it will only let me open one file. my code looks like this:
    string[] paths = FileBrowser.Instance.OpenFiles("Open file", "", "*", "mp4", "mov");
     
  39. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Are you sure this is also the case in builds?
    Have you enabled "Native Inside Editor" in the configuration:
    upload_2021-1-12_17-1-44.png


    Cheers
    Stefan
     
    Vic070 likes this.
  40. Vic070

    Vic070

    Joined:
    Aug 6, 2016
    Posts:
    9
    This worked for me, thanks
     
  41. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    I've received some worrying messages from various Linux users that the file browser stopped working on (newer?) distros, here's what one user said:

    As of Fedora 33, the Red Hat developers made the decision to move from X11 display server protocol to the new Wayland protocol. Whenever I run Asset Forge, I cannot open the file dialog panel.

    (You can view the full conversation here, Asset Forge is the software I made using Unity and File Browser)

    and today another error report here.

    I know the description said that no support for the Linux dialogs are given but it seems to me that in the future all Linux support might break - however I'm not too invested into Linux to know how much truth there is to this. Would love your input and/or help!
     
  42. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Hi Kenney

    Unfortunately, I can't say what exactly causes the problem since Unity and Linux are quite a mess...

    Anyway, I would recommend that you use the fully integrated and free "RTFB" for Linux-builds:
    https://assetstore.unity.com/packages/slug/113006?aid=1011lNGT

    I hope this helps you further.


    Cheers
    Stefan
     
  43. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    Ah yeah, not a big fan of using something like this due to the visual style which has to be edited to fit our software - however if that's the solution I'm afraid I'll have to go with that. Hopefully Linux support will be improved in the future though!
     
  44. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    Sure, we always improve our assets.

    However, the problems under Linux are not our fault. First of all, Unity doesn't really support the platform, so there are plenty of bugs, especially if native code is needed... Furthermore, there are tons of different distros with myriads of configurations, kernels etc, which makes it nearly impossible to run seamlessly on all of them.
    Therefore, we included the source for the Linux-part and it could be compiled on the target-platform.

    We can't do much more, but we will certainly look for possible enhancements.
     
  45. KenneyWings

    KenneyWings

    Joined:
    Sep 29, 2016
    Posts:
    32
    Yeah understood, I'm with you. For now our software comes with a little warning that it's tested on Ubuntu and so far that seems to work absolutely fine, so any other distro is at the users risk. Thanks!
     
    Stefan-Laubenberger likes this.
  46. Creator-of-1BITDRAGON

    Creator-of-1BITDRAGON

    Joined:
    Jul 19, 2019
    Posts:
    17
    Last edited: Mar 24, 2021
  47. Stefan-Laubenberger

    Stefan-Laubenberger

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

    We made a fix that should prevent this issue.
    If you like to have access to it, please send us your invoice via email.


    Cheers
    Stefan
     
  48. Creator-of-1BITDRAGON

    Creator-of-1BITDRAGON

    Joined:
    Jul 19, 2019
    Posts:
    17
    Thank you Stefan for your prompt reply!
    Do you plan to release a new version of File Browser PRO soon that includes this fix? If so, I can wait for the update, no problem.
     
  49. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,976
    We will release the update next week :)
     
  50. Creator-of-1BITDRAGON

    Creator-of-1BITDRAGON

    Joined:
    Jul 19, 2019
    Posts:
    17
    Great! thank you very much :)
     
    Stefan-Laubenberger likes this.