Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

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,876
    Hi

    Thank you for your interest in our product!

    Yes, File Browser is working on both architectures.
    I hope this helps you further.


    Cheers
    Stefan
     
  2. JPMay

    JPMay

    Joined:
    Dec 13, 2021
    Posts:
    6
    Cheers @Stefan-Laubenberger , thanks we just bought it. Installing and testing on Mac and PC native.

    I have a concern, up above you mention a problem with bundle id?

    Surely - there is no problem using the library when we send to the app store, and in particular, when we package the app with CI/CD ??

    Any thoughts? mfg, JP
     
  3. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Hi JP

    Afaik it should work with CI/CD.
    In case you're experiencing any issues, disable "Modify Bundle" in the configuration:
    upload_2022-2-10_14-40-32.png

    I hope this helpy you further.


    Cheers
    Stefan
     
  4. Grandpa3D

    Grandpa3D

    Joined:
    Jun 23, 2019
    Posts:
    13
    I have used FileBrowser pro for a couple of projects and have been extremely pleased with it. In the project I am currently working on though I need to be able to listen to when the file browser cancel button is clicked. Is this possible?
     
  5. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I assume you're listening to the callbacks from File Browser, right? They have a bool parameter "selected" - if it's false, it implies "Cancel" was pressed. Is that sufficient enough for you?


    Cheers
    Stefan
     
  6. Grandpa3D

    Grandpa3D

    Joined:
    Jun 23, 2019
    Posts:
    13
    Thank you for the response Stefan. The selected parameter in the callback should suffice.
     
    Stefan-Laubenberger likes this.
  7. megavoid-de

    megavoid-de

    Joined:
    Sep 29, 2020
    Posts:
    8
    Hi,

    I just encountered an issue compiling our project on macOS (IL2CPP) after updating from 2021.3.2 to 2021.3.6.

    Basically it could not find the platform properties. I changed lines 620 and 626 in Common/Scripts/Util/FileHelper.cs, adding the BaseHelper class name to the platform properties:

    Code (CSharp):
    1. if (BaseHelper.isWindowsPlatform || BaseHelper.isWindowsEditor)
    2.                      {
    3.                         process.StartInfo.FileName = "explorer.exe";
    4.                         process.StartInfo.UseCmdExecute = true;
    5.                         process.StartInfo.CreateNoWindow = true;
    6.                      }
    7.                      else if (BaseHelper.isMacOSPlatform || BaseHelper.isMacOSEditor)
    8.                      {
    9.                         process.StartInfo.FileName = "open";
    10.                      }
    11.                      else
    12.                      {
    13.                         process.StartInfo.FileName = "xdg-open";
    14.                      }
    That fixed the compiler issues.
     
    Stefan-Laubenberger likes this.
  8. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Thank you very much!
    This is fixed in the upcoming version.
     
    megavoid-de likes this.
  9. Grandpa3D

    Grandpa3D

    Joined:
    Jun 23, 2019
    Posts:
    13
    I have made a custom package that needs a reference to Crosstales. Is there an assembly somewhere that I am missing.
     
  10. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Can you please provide more details?

    However, if you create your own package that uses our assets, please make sure you include our code too, located under "Assets/Plugins/crosstales".
     
  11. Grandpa3D

    Grandpa3D

    Joined:
    Jun 23, 2019
    Posts:
    13
    The package I am creating has a USING reference to Crosstales.FB in code. When I put the code into the package Unity complains that I am missing a "using or an assembly reference for Crosstales". For other plugins like TMPro all I have to to put a reference to the associated assembly in my custom packages assembly definition asset. However I can not locate an assembly definition reference for Crosstales.
    I hope this explanation helps.
     
  12. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    You could create your own assembly definition inside "Assets/Plugins/crosstales/" and reference it.
    Alternatively, you could add the compile define #if CT_FB around the referenced code from our asset.
    I hope this helps you futher.
     
  13. Grandpa3D

    Grandpa3D

    Joined:
    Jun 23, 2019
    Posts:
    13
    Neither of these options works. Wrapping the effected code with #if CT_FB still throws errors when file Browser plugin is installed and the Class file is in the package folder. The other option would require an assembly definition inside "Assets/Plugins/crosstales/" for every project that uses my custom plugin. This seems very error prone. Would it be possible for Crosstales to provide the needed assembly definitions with the File Browser Pro plugin.
     
    Last edited: Mar 24, 2022
  14. joshuaFS

    joshuaFS

    Joined:
    Jul 23, 2018
    Posts:
    6
    This latest version doesn't compile for UWP/WSA. Not sure how you released it without checking if it compiles, but here are two problems:

    FileHelper.cs - line 198. Uses the variable "extensions" when trying to pass to function "fbWsa.GetFilesForName", but there is no such variable in this context, and it should clearly be the variable "filenames" that was passed in a few lines above.

    FileBrowserWSA.cs - line 38. Tries to set "fbWsa.DEBUG", but there is no "DEBUG" in the class for "fbWsa".

    I went ahead and just fixed these in the source so I can move forward, so not a blocking problem for me right now. Just disappointing.
     
  15. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I apologize for the problems the update caused!
    Version 2022.1.1 is now online and should fix the problems under UWP (WSA).
    Please let me know if it works for you.


    So long,
    Stefan
     
  16. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    If you add the compile define around all affect code I can't imagine it still throws an error...
    However, we will consider adding an assembly definition in the upcoming release.
     
  17. Grandpa3D

    Grandpa3D

    Joined:
    Jun 23, 2019
    Posts:
    13
    I am a little new to creating custom packages and as I now understand it I have been using the wrong custom package format. The one I've been using creates a package.json file and the one I should be using creates a x.unitypackage file. So there is actually no problem with using the #if CT_FB compile define.
     
    Stefan-Laubenberger likes this.
  18. V-Rangers-Support

    V-Rangers-Support

    Joined:
    Feb 6, 2018
    Posts:
    10
    Hi, I have some issue with the SaveFileAsync system. It work when I use it in build, but when I reload the scene in build and use again SaveFileAsync, it don't work or randomly. Everytime I reload my scene, I put null to the both variable lastFileSave and CurrentSaveFile ( I try without reset this variable to null with no success). In fact, the bool selected for some reason back to 0 even if i select a file.

    I'm very confuse, I don't know if I miss a variable. I try to remove it each reload, and I try to put it in the Don't Destroy, but I always get the error.
     
  19. Stefan-Laubenberger

    Stefan-Laubenberger

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

    If you subscribe your instances to the callbacks, make sure you unsubscribe them in "OnDestroy".
    Furthermore, add FileBrowser in the first scene (e.g. Splash) that isn't reloaded or don't add it at all - it will add itself.
    You shouldn't modify the variables/properties - they simply represent the last state of FB.

    I hope this helps you further.


    Cheers
    Stefan
     
  20. V-Rangers-Support

    V-Rangers-Support

    Joined:
    Feb 6, 2018
    Posts:
    10
    HI,

    Thanks for your replay, indeed, I stoped to call FileBrowser each time I reaload my scene because I put FileBrowser on the Don'tDestroyOnLoad with a previous scene, and it works very well.

    Have a nice day
     
    Stefan-Laubenberger likes this.
  21. Poly_Games

    Poly_Games

    Joined:
    Apr 23, 2018
    Posts:
    1
    Hello,
    just wanted to know if this is compatible with Unity 2021.2.17f1 and IL2CPP.
    As I already tried 2 other native FileBrowser who ran into issues with this combination.
    If yes I'll buy it for sure.
    Thanks in advance.
     
  22. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Yes, it works with your Unity version and IL2CPP.


    Cheers
    Stefan
     
    Poly_Games likes this.
  23. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    Hello Stefan,
    I am using FileBrowser PRO 2022.1.1 in Unity 2021.2.12f1 on a 2021 MacBook Pro M1 Pro (Silicon), MacOS 12.0

    I have been using FileBrowser PRO in my app for two years now, and generally it works perfectly. However, I've realized there is a pretty serious bug on Apple Silicon.

    1. Create a release build for Apple Silicon

    2. Open a FileBrowser Open File dialog from inside the created app.

    3. Click on any application or window outside of the app.

    4. Return to the Unity app - the app is permanently frozen with the spinning rainbow wheel, and must be Force Quit.


    This is really frustrating if you realize you need to do something quickly in the Finder when you are in the process of opening a file.

    The bug only seems to be replicable on release builds on Apple Silicon - not replicable in the Editor or on Intel Macs.

    If you need me to send a video capture I can.


    I hope it will be possible to fix this - I know you may have limited access to a Silicon Mac still.

    Thank you
     
  24. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I would recommend to update to the latest version 2022.1.1.
    However, are you using async-methods for the FileBrowser?


    So long,
    Stefan
     
  25. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    I am using version 2022.1.1.

    This is my call to FileBrowser - I don't believe it is async.

    Should it be? If this code is incorrect, please provide the correct code with which I should be making this call:

    Code (CSharp):
    1. string path = FileBrowser.Instance.OpenSingleFile(windowTitle, null, "", extensionFilters);
     
  26. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Sorry, I read the version wrong - I'm getting old ;)

    Yes, you are using the synchronous version of the call - can you please try it with async?
    It works with callbacks, like this example:
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3. using Crosstales.FB;
    4.  
    5. /// <summary>
    6. /// Simple example to demonstrate the basic usage of File Browser with async-calls.
    7. /// </summary>
    8. public class SimpleAsyncFBExample : MonoBehaviour
    9. {
    10.    public string Extension = "txt";
    11.    public Text Result;
    12.  
    13.    private void Start()
    14.    {
    15.       Result.text = "No file selected!";
    16.    }
    17.  
    18.    private void OnEnable()
    19.    {
    20.       FileBrowser.Instance.OnOpenFilesComplete += onOpenFilesComplete;
    21.    }
    22.  
    23.    private void OnDisable()
    24.    {
    25.       if (FileBrowser.Instance != null)
    26.          FileBrowser.Instance.OnOpenFilesComplete -= onOpenFilesComplete;
    27.    }
    28.  
    29.    public void OpenFile()
    30.    {
    31.       FileBrowser.Instance.OpenSingleFileAsync(Extension);
    32.    }
    33.  
    34.    private void onOpenFilesComplete(bool selected, string singlefile, string[] files)
    35.    {
    36.       Result.text = string.IsNullOrEmpty(singlefile) ? "<color=red>No file selected!</color>" : singlefile;
    37.    }
    38. }
    Does that help you further?
     
  27. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    It looks lik
    It looks like that fixes the issue!

    Thank you for the support, appreciate the quick response!
     
    Stefan-Laubenberger likes this.
  28. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    Hello Stefan,

    Sorry to be posting again. After I updated to the async version of OpenSingleFileAsync(), I received a bug report from a user, and I was able to replicate the bug on both Intel and Silicon Macs.


    1. Open a window using OpenSingleFileAsync() on a MacOS release build on either Intel or Silicon Mac

    2. Click on and attempt to type in the search bar at the top right of the open file dialog

    3. The app freezes


    Are you able to replicate this as a general issue? Is there anything I can do to fix it?

    Thank you
     
  29. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I will take a look tomorrow and build on an Intel Mac.
    Just some questions/suggestions for the meantime:
    1. Have you built for IL2CPP or Mono? Please try the opposite build option.
    2. Have you tried it with the latest Unity 2021.2.19?
    3. Do you see any problems in the application log?


    So long,
    Stefan
     
  30. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    Building for Mono fixes the issue.

    Unfortunately, I need to distribute my app as an IL2CPP build for security reasons.

    I hope it will be possible to fix the issue so that the plugin is compatible with IL2CPP builds on MacOS?

    Thank you
     
  31. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    And the answers to my other questions? ;)
     
  32. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    Sorry! I hate when users do that :)

    2. Currently using 2021.2.19

    3. There are no problems in the logs.

    However, I did just realize something while testing just now - if you navigate away from the OpenFiles window, then back to the application, it then fills in whatever typing you had previously entered. It still seems frozen after that, but you can keep leaving and returning to see it momentarily update the window.

    Still needs to be fixed - but apparently not a full freeze.
     
    Stefan-Laubenberger likes this.
  33. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Have you enabled "Run in Background" and "Visible in Background" in the player settings?
     
  34. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    Both Run in Background and Visible in Background are enabled.
     
  35. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Can you please send us an email with your invoice? We have a new version ready for you ;)
     
  36. zonghaha

    zonghaha

    Joined:
    Apr 12, 2021
    Posts:
    3
    Hi,
    How can I pick an app bundle from the "/Applications" folder on macOS?
    I tried both OpenSingleFile and OpenSingleFolder, but all applications are grey in the dialog.

    Thanks.
     
  37. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I assume you already tried "OpenSingleFile" with "app" as extension (and wildcard "*")?


    So long,
    Stefan
     
  38. zonghaha

    zonghaha

    Joined:
    Apr 12, 2021
    Posts:
    3
    Thanks for your reply!
    I just found that "OpenSingleFile" has different behaviors between Unity Editor and Mac standalone build.
    "OpenSingleFile(string.Empty, "/Applications", string.Empty, string.Empty)" works in the Editor, and "OpenSingleFile(string.Empty, "/Applications", string.Empty, "app")" works in the Mac standalone build.
     
  39. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Ok, I will take a look at it. Unfortunately, we use Unitys own file browser inside the Editor, so I assume it's not really fixable...
    However, I assume apart from this issue, it now works for you, right?
     
  40. zonghaha

    zonghaha

    Joined:
    Apr 12, 2021
    Posts:
    3
    Yes, it works now. Thanks!
     
    Stefan-Laubenberger likes this.
  41. sammy_unity731

    sammy_unity731

    Joined:
    May 5, 2021
    Posts:
    2
    Hi,
    I just get "File Browser PRO" from Asset Store with "WebGL Native File Browser".
    However, it shows an error at the very begining as I just imported both assets to a new empty projct (2020.3.30f1) in WebGL build.
    Code (CSharp):
    1. Assets\Plugins\crosstales\FileBrowser\Scripts\Wrapper\FileBrowserWindows.cs(8,38): error CS0246: The type or namespace name 'BaseFileBrowseStandalone' could not be found (are you missing a using directive or an assembly reference?)
    Is there any quick guide for whom on the first try to use "File Browser PRO" with WebGL build? I cannot find it from your PDF doc.
    Thanks!
     
  42. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Have you installed "WebGL Native File Browser.unitypackage" from "Assets\Plugins\crosstales\FileBrowser\3rd party"?
    Please also make sure that the "FrostweepGames"-folder is inside "Assets/Plugins". If not, please move it there.

    Does that help?


    So long,
    Stefan
     
  43. sammy_unity731

    sammy_unity731

    Joined:
    May 5, 2021
    Posts:
    2
    Hi, Stefan,

    Thank you for the prompt reply. The same error still goes out. I have email you a clip on how I import and set all the assets, for you as the reference. Please take a look. Thank you!
     
  44. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    I wrote you an email :)
     
  45. AbsurdAndy

    AbsurdAndy

    Joined:
    Dec 6, 2019
    Posts:
    40
    Heya! Using your plugin works great on Windows, MacEditor, but not in MacStandalone. My code;

    Code (CSharp):
    1.                 void OnFileSelected(bool selected, string filePath, string multiFileSelect)
    2.                 {
    3.                     FileBrowser.Instance.OnOpenFilesCompleted.RemoveListener(OnFileSelected);
    4.  
    5.                     if (selected && !string.IsNullOrEmpty(filePath))
    6.                     {
    7.                         // Success
    8.                     } else {
    9.                         // Failure <---
    10.                     }
    11.                 }
    12.                 FileBrowser.Instance.OnOpenFilesCompleted.AddListener(OnFileSelected);
    13.                 string[] extensions = {"jpeg", "jpg", "png"};
    14.                 FileBrowser.Instance.OpenSingleFileAsync("Select Image", "", "", string.Join(',', extensions));
    After selecting a .png file and hitting "open" on MacOS standalone, the "Failure" branch is called with "selected" being false (and the filePath and MultiFileSelect strings are both null).

    Anything I'm doing wrong?
     
  46. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Hi!

    What's your current version of the asset?


    Regards,
    Stefan
     
  47. AbsurdAndy

    AbsurdAndy

    Joined:
    Dec 6, 2019
    Posts:
    40
    I'm on 2022.1.3. Using Unity 2021.3.5. Compiling for Mono, and Intel+Silicon builds. I'm just doing a local build so no codesigning or anything, just hitting "build and run" within unity.
     
    Last edited: Aug 4, 2022
  48. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    Can you please verify if the callback is called twice after the file was selected, once with selected=false and no file and the second time with the selected=true and the file?


    Edit:
    I think we found a fix for the problem, can you please send us your invoice via email?
     
  49. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,876
    We've just released version 2022.2.0 of File Browser.
    Main changes:
    • Fix for UWP (WSA) builds
    • Prevent callbacks from firing too early
    • Compile define CT_FB_PRO removed
    • Editor integration improved
    • Minimal supported version is now Unity 2019.4 or newer
    • Updated to Common 2022.2.0
     
  50. Kyle_MT

    Kyle_MT

    Joined:
    Aug 8, 2022
    Posts:
    4
    Hi, I have trouble opening either files or a single folder. I've bought plugins both WebGL Native File Browser and this one. Both plugins are installed under Assets/Plugins/, which are crosstales and FrostweepGames. When APIs are called from a built WebGL player, the console shows the following messages:

    'OpenFolders' is currently not supported for the current platform!
    'OpenFiles' is currently not supported for the current platform!

    Looks like methods in FileBrowserGeneric are called, which are not implemented. What possible settings or steps am I missing? Please help!

    Unity version: 2020.3.30f1
    Platform: WebGL
     
    Last edited: Sep 23, 2022 at 2:47 AM
unityunity