Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

  2. Unity 2022.1 is now available as the latest Tech release.
    Dismiss Notice
  3. Improve your project's performance with our new guide on profiling in Unity.
    Dismiss Notice

File Browser - Native file browser

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

  1. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    - Yes, I have enabled "Intel" and "Apple Silicon" on the library.

    - It does not seem that the M1 Bundle works on Intel, as per my previous post. Are you able to successfully use the M1 extracted Bundle in a build running on your Intel Mac without errors?
     
  2. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    I can't verify it right now since I'm on holiday until the end of the week, but I will test it asap when I'm back.
    Meanwhile, you could try to build the library from the souce code.
     
  3. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    No worries - I very much understand about being on holiday.

    The solution I'm using for the moment is use the original .bundle file, and build only for Intel, meaning the M1 users are using the build through Rosetta.
    The users have said this is working for them now (I don't have an M1 Mac yet either).
    I imagine they are taking a performance hit, but at least they aren't leaving 1 star reviews for the moment.


    1. On your return, I would appreciate it very much if you can think a bit more about whether the way you currently have it setup for Mac builds is sufficient for how developers need to submit to the App Store. Developers can only submit one build to App Store Connect for all architectures, so I'm not sure if the current setup of extracting and replacing the .bundle file depending on architecture is suited to the fact that one universal binary build needs to work for both architectures.

    2. If I'm wrong, and you were intending for the zipped M1 .bundle file to work on both Intel and Apple Silicon already, it does not seem to be working on Intel at this time, and you should be able to test this issue by making an Intel build with the unzipped M1 .bundle file, on your existing Intel Mac on your return.

    Thank you, and enjoy your holiday
     
    Stefan-Laubenberger likes this.
  4. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Thank you!
    I will try to build an bundle that works on all platforms, that's the ultimate goal :)
     
  5. Ayrizale

    Ayrizale

    Joined:
    Apr 16, 2021
    Posts:
    3
    Hello,

    I'm having some trouble with SaveFile(). Here's the code that I've got:

    Code (CSharp):
    1.     public void OnExportButtonPressed()
    2.     {
    3.         string path = FileBrowser.Instance.SaveFile("Export Database", "", "My_Database", "*");
    4.  
    5.         if (path.Length != 0)
    6.         {
    7.             string sourcePath = Application.persistentDataPath + "/My_Database";
    8.             System.IO.File.Copy(sourcePath, path, true);
    9.         }
    10.     }
    This works fine in the Editor, it copies the file just as I would expect it to.

    But when I build the application and try to export the file, the SaveFile Dialog shows a *.* in the filename line and if I enter the name of a file that doesn't already exist in the folder, it says that the "File name is not valid".

    Thanks in advance for any help.
     
  6. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Hi Ayrizale

    Yes, you're right - "*" alone won't work. Please specify at least one extension, like:
    Code (CSharp):
    1. string path = FileBrowser.Instance.SaveFile("Export Database", "", "My_Database", "db", "*");

    Cheers
    Stefan
     
  7. Ayrizale

    Ayrizale

    Joined:
    Apr 16, 2021
    Posts:
    3

    Worked perfectly, thank you.
     
    Stefan-Laubenberger likes this.
  8. Archtica

    Archtica

    Joined:
    Mar 23, 2018
    Posts:
    17
    Hi Stefan, first of all thank you for a great product.
    With the new update I get the following error building for UWP:

    Assets\Plugins\crosstales\FileBrowser\Scripts\Wrapper\FileBrowserWSA.cs(56,69): error CS0507: 'FileBrowserWSA.CurrentOpenSingleFile.set': cannot change access modifiers when overriding 'public' inherited member 'BaseFileBrowser.CurrentOpenSingleFile.set'

    Assets\Plugins\crosstales\FileBrowser\Scripts\Wrapper\FileBrowserWSA.cs(57,66): error CS0507: 'FileBrowserWSA.CurrentOpenFiles.set': cannot change access modifiers when overriding 'public' inherited member 'BaseFileBrowser.CurrentOpenFiles.set'

    Assets\Plugins\crosstales\FileBrowser\Scripts\Wrapper\FileBrowserWSA.cs(58,71): error CS0507: 'FileBrowserWSA.CurrentOpenSingleFolder.set': cannot change access modifiers when overriding 'public' inherited member 'BaseFileBrowser.CurrentOpenSingleFolder.set'

    Assets\Plugins\crosstales\FileBrowser\Scripts\Wrapper\FileBrowserWSA.cs(59,68): error CS0507: 'FileBrowserWSA.CurrentOpenFolders.set': cannot change access modifiers when overriding 'public' inherited member 'BaseFileBrowser.CurrentOpenFolders.set'

    Assets\Plugins\crosstales\FileBrowser\Scripts\Wrapper\FileBrowserWSA.cs(60,63): error CS0507: 'FileBrowserWSA.CurrentSaveFile.set': cannot change access modifiers when overriding 'public' inherited member 'BaseFileBrowser.CurrentSaveFile.set'
     
  9. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Please send me your invoice via email and I will provide you with a fix.
     
  10. Archtica

    Archtica

    Joined:
    Mar 23, 2018
    Posts:
    17
    Sent
     
  11. megavoid-de

    megavoid-de

    Joined:
    Sep 29, 2020
    Posts:
    6
    Hi all,

    We are doing the same for our test builds right now. Building Intel only works quite well on M1 Macs as well but is no sustainable solution in the long run as Rosetta2 is just intended as a bridge technology that will be discontinued more sooner than later.

    The M1 bundle does not work in Universal builds on our Intel Macs. The App will give a beachball of death and slow down the whole system to 2-3 seconds per frame the moment a File Browser Pro window is opened.
     
  12. Stefan-Laubenberger

    Stefan-Laubenberger

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

    We're working on an Universal-library and hope to release it until the end of the month.
    Meanwhile, it's always possible to rebuild the bundle with the source code in Xcode.


    Cheers
    Stefan
     
    megavoid-de likes this.
  13. Nesit

    Nesit

    Joined:
    Dec 24, 2019
    Posts:
    8
    Hi,

    We are using your plugin for Universal Windows Platform. It works pretty much as expected, no problems at all. However, Windows Store moderation team rejects our application for the following reason:

    "More information is required to review your request for using restricted capabilities:
    broadFileSystemAccess

    Please provide us with specific reasons why the FilePicker/FolderPicker/FutureAccessList APIs do not meet your needs."

    As I understand, application requests unnecessary permissions because of "broadFileSystemAccess" capability, and moderation requests us to use "FilePicker/FolderPicker/FutureAccessList APIs" instead, or explain, why it isn't possible. The code we use:


    Code (CSharp):
    1. var extensions = new[] { new Crosstales.FB.ExtensionFilter("Image Files", "png", "jpg", "jpeg") };
    2. var paths = FileBrowser.Instance.OpenFiles("Open File", "", "", extensions);


    Any idea, how to fix it? Thanks in advance!
     
  14. Stefan-Laubenberger

    Stefan-Laubenberger

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

    As it seems, there are only two possibilities:
    1. Remove the capabilitiy "broadFileSystemAccess". This will allow only "safe" path destinations allowed by MS
    2. Try to explain the reviewer why full file system access is mandatory
    I hope this helps you further.


    Cheers
    Stefan
     
  15. MrPeperoni

    MrPeperoni

    Joined:
    Oct 9, 2018
    Posts:
    4
    Hey Stefan,

    thank you very much for this great asset and your great support.
    I downloaded your asset and it works so far very well. I only have one problem what I'm not really unterstand and I hope you can help me with it.

    First my sepcs:
    Unity 2020.1.17f
    Windows 10
    Filebrowser Pro 2021.2.5

    My example:
    Code (CSharp):
    1. // async version
    2. FileBrowser.Instance.OpenFilesAsync(SetPathToLoad, false, "json");
    3.  
    4. // sync version
    5. SetPathToLoad(FileBrowser.Instance.OpenSingleFile("json"));
    My problem:
    I simply wanna save and load a json-file with my configurations. And mostly it works without any problems but from time to time (and currently I don't now when it get triggered) my whole unity editor freeze when I want to open the fileBrowser and then I have to restart everything.
    Do you have maybe an idea what the reason for this could be? Is it wrong that I use FileBrowser.Instance?

    I hope you can help me.

    Sincerly
    Alex
     
  16. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Hi Alex

    Thank you very much for investing into our asset!

    I don't know why this is happening :(
    Have you enabled or disabled "Native Inside Editor"?
    upload_2021-7-19_15-16-42.png


    So long,
    Stefan
     
  17. MrPeperoni

    MrPeperoni

    Joined:
    Oct 9, 2018
    Posts:
    4
    My "Native Inside Editor" was disabled. I enabled it now and will check it out if it changes something.
    Maybe this is the answer. I will let you know.
     
    Last edited: Jul 20, 2021
  18. MrPeperoni

    MrPeperoni

    Joined:
    Oct 9, 2018
    Posts:
    4
    Ok, I enabled "Native Inside Editor" and now the save editor doesn't open anymore. Loading still works like before but when I want to save something then the method (FileBrowser.Instance.SaveFile("save_"+DateTime.Now.ToString("dd-MM-yyyy_HH:mm"),"json")
    is called but no window will open and it only returns Null.

    With a disabled "Native Inside Editor" then saving works normaly. What's the difference?
     
  19. Stefan-Laubenberger

    Stefan-Laubenberger

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

    The problem is the colon ":" in the format string. It should look like that: dd-MM-yyyy_HH_mm
    Anyway, the next update will print a warning in the console.


    Cheers
    Stefan
     
    MrPeperoni likes this.
  20. mumudo

    mumudo

    Joined:
    Oct 2, 2017
    Posts:
    4
    Hi Stefan. I am a junior dev from Volta. I've been trying to get ShowFolder() to work in Mac and WIN Builds as it only works in editor for both platforms. I keep getting this in Mac Builds: tid_303 (1): EXC_BAD_ACCESS (code=1, address=0x0) and I get this "the application can't be opened -50" pop up. On WIN builds, I keep getting this "Could not show file location. System.ComponentModel. Win32Exception (0x80004005): mono-io-layer (0)" in my dev build console. I'm wondering if you would know what I'm missing? I've also tried editing my saved path string to use forward slashes, back slashes, and no slashes with various results, but all of which did not help make ShowFolder work in builds. Thank you!
     
  21. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Please send me your invoice via email and I will give you access to an updated package.


    Cheers
    Stefan
     
  22. leoNERDo

    leoNERDo

    Joined:
    Feb 2, 2013
    Posts:
    15
    Hi FB-Team,

    we have a wierd problem with file extensions and linux when saving a file.
    The problem:
    When we use SaveFile() in a linux build the extension (.txt) is missing in the end of the filename and the file saves without the extension.
    In an other file we have a double extensions (.tar.bz2) and the second one is missing.

    But in the Unity Editor under the same linux pc the extensions are there.

    We use
    Code (CSharp):
    1. new ExtensionFilter("Text", ".txt")
    It seems like that somehow in the build FB cuts the last extension. :eek:
    Any ideas?

    Greets Marco :)

    Unity Verison: 2019.4.4.f1
    Ubuntu 20.04 LTS
    FB Version 2020.4.1 Pro
     
  23. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Hi Marco

    Hmm, I'm not sure about the problem atm... :(
    Can you please comment line 207 ("if (Util.Config.DEBUG)") in "FileBrowserLinux.cs" and create and run the build?
    What is the result in the application log?


    So long,
    Stefan
     
  24. leoNERDo

    leoNERDo

    Joined:
    Feb 2, 2013
    Posts:
    15
    Hi Stefan,

    I updated FB to the newest version (2021.2.5) and did what you suggested.

    My Results in the player.log is:
    Code (CSharp):
    1. getFilterFromFileExtensionList: Text;txt
    2. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    3.  
    4. getFilterFromFileExtensionList: Archive;bz2
    5. (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 39)
    But it still does not work in the build.

    Greets,
    Marco
     
  25. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Thanks for testing it!

    What happens if you add an additional extension, e.g. "csv", to your "Text" extension type?
    Does it just ignore the last extension for any given extension type?
    What's the result then in the player.log with multiple extensions?
     
  26. leoNERDo

    leoNERDo

    Joined:
    Feb 2, 2013
    Posts:
    15
    The Result is
    Code (CSharp):
    1. getFilterFromFileExtensionList: Text;txt,csv
    All given extensions are shown in the log.
    But still not in the file window.

    Screenshot from 2021-07-28 15-10-28.png

    Thanks for your help.
     
  27. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Unfortunately I have to ask again to understand the problem: are neither files of the type "txt" nor "csv" shown or is only "csv"-missing?
    Would you mind do the same test for "OpenFile"? Does it behave the same?
    I'm currently on holiday and have no Linux-machine available :(
     
  28. leoNERDo

    leoNERDo

    Joined:
    Feb 2, 2013
    Posts:
    15
    Hi,
    no problem :)

    When the "Save File" Window opens, then the file extension is missing in the file name field.
    Also when multiple extensions are given, only the first one can be selected in the file type dropdown. See image.
    Screenshot from 2021-07-28 15-10-28.png
    The problem is, when the user hits the save button, the file will be saved without an extension. This causes a problem when the user later trys to open the file again. He can't find it and our software does validate the file type.

    However this behavior is only in the build not in the editor.o_O

    Opening files works fine. I can see all files with the given extensions.

    Have a nice holiday :cool:
     
  29. Immotion_Tech

    Immotion_Tech

    Joined:
    Apr 11, 2018
    Posts:
    1
    Hello!
    First time using FileBrowserPro for Mac (long time FileBrowser user) - am getting DllNotFoundException: FileBrowser in build (Development Build). Am working on M1 and have swapped the FileBrowser bundle as directed - any help?
     
  30. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Can you please send us your invoice via email?
     
  31. leoNERDo

    leoNERDo

    Joined:
    Feb 2, 2013
    Posts:
    15
    Hi,
    any updates on the file extansion problem?

    Greets
     
  32. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Please send us your invoice via email and we can give you access to the latest build.


    Cheers
    Stefan
     
  33. jnorthrup

    jnorthrup

    Joined:
    Oct 1, 2019
    Posts:
    1
    A fresh download of 2021.3.3 via the Asset Store resulted in a missing binary inside
    FileBrowser.bundle. I had to compile from source to gain functionality of
    FileBrowser.bundle.
     
  34. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I apologize for the hassle, but it seems a bit strange it didn't work out-of-the-box. :(
    Would you mind sending us your new bundle via email so we can check the differences?

    Thank you!


    Cheers
    Stefan
     
  35. lustgunther

    lustgunther

    Joined:
    Aug 22, 2017
    Posts:
    8
    Hello Stefan, we have an urgent problem on MacOS with the FileBrowser PRO. In Editor Mode and after building for MacOS everything works well. But after Signing the Application for distribution to the AppStorConnect, the FileBrowser won't open anymore.
    FileBrowser.Instance.OpenSingleFile(...) seems to just return null without ever opening the dialog.

    For debugging I created an empty sample project in Unity2020.3f. Just imported the FileBrowser PRO from the PackageManager and build the example scene "DemoSync". I experienced the exact same problem.


    My workflow after building the Sample App.app in terminal looks like:
    Code (CSharp):
    1. sudo chmod -R a+XR "SampleApp.app"
    2.  
    3. sudo codesign --deep --force --verify --verbose --timestamp --sign "3rd Party Mac Developer Application: Sample GmbH" "SampleApp.app/Contents/Plugins/FileBrowser.bundle"
    4.  
    5. sudo codesign -f --deep -s "3rd Party Mac Developer Application: Sample GmbH" --entitlements "/Users/SampleUser/Repos/sampleApp.entitlements" "Sample App.app"
    6.  
    Content of my sampleApp.entitlements:
    Code (CSharp):
    1. <?xml version="1.0" encoding="UTF-8"?>
    2. <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    3. <plist version="1.0">
    4. <dict>
    5.     <key>com.apple.security.app-sandbox</key>
    6.     <true/>
    7.     <key>com.apple.security.network.client</key>
    8.     <true/>
    9.     <key>com.apple.security.cs.disable-library-validation</key>
    10.     <true/>
    11. </dict>
    12. </plist>
    13.  
    Build Settings for Standalone:
    TargetPlattform: MacOS
    Architecture: Intel 64-bit + Apple Silicon

    Thanks for your help!
     
  36. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Wasn't there a MacOS dialog at the first call of FB which asked for the permission to access the file system?

    Unfortunately, our only Mac is currently broken and must be repaired :(
    Therefore, my help is very limited.

    However, can you please build the FileBrowser.bundle in XCode with the source code?
    That hopefully solves the issue - if not, please contact us via email. We may have another solution.

    Please let me know.


    So long,
    Stefan
     
  37. lustgunther

    lustgunther

    Joined:
    Aug 22, 2017
    Posts:
    8
    There was no such dialog.
    My xcode experience is very limited, but i will try my best and keep you updated. Thanks for the quick answer!
     
  38. lustgunther

    lustgunther

    Joined:
    Aug 22, 2017
    Posts:
    8
    Building it my self didn't helped. It again worked in the example project editor and build, but not when signed. No permission dialog was opened. I wrote you a mail...
     
  39. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    Hello Stefan,
    Just tried upgrading FileBrowser PRO to take advantage of the M1 compatibility.

    Unfortunately, like lustgunther, I am unable to successfully include it in a Mac build for the App Store.

    I think the issue here has to do with the bundle identifier.

    - Previous versions of File Browser PRO added a random numeric identifier to the .bundle Info.plists.

    - However, in the new version, no identifiers are added.

    - When I add the random numbers to the end of the Bundle Identifier in the Info.plist in FileBrowser.bundle, the plugin no longer loads at runtime, and the error:
    Code (CSharp):
    1. DllNotFoundException: Unable to load DLL 'FileBrowser': The specified module could not be found.
    2.   at Crosstales.FB.Wrapper.Mac.NativeMethods.DialogOpenFilePanel (System.String title, System.String directory, System.String extension, System.Boolean multiselect) [0x00000]
    is thrown in the log.

    Have you fully tested submitting a build with the new version of the plugin to the Mac App Store? Is there a new suggested manual solution for submitting release builds to Apple now that the plugin is no longer automatically adding the numeric suffix to the Bundle Identifier?

    Thank you
     
  40. Stefan-Laubenberger

    Stefan-Laubenberger

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

    Unfortunately, changing the bundle id will break our signed bundle - Mac is such a pain to develop something :(
    We will get our Mac back next week, so we can do some more tests.

    Until then, I can't give you only three options:
    1. Try it on another Mac to verify the behaviour
    2. Build the bundle from the source code
    3. Use our integration for the free Runtime File Browser

    We will inform you asap about our findings.


    So long,
    Stefan
     
  41. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    Have you had a chance to do some testing on Mac for the bundle identifier issue yet? Really hoping to get a Silicon build out soon.

    Thank you
     
  42. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    We made some tests and on our Intel Mac everything works.
    Unfortunately, we don't own a Silicon Mac, but we know various customers that were able to build for it without any problems. :(

    Please make sure you are using the latest Unity versions of 2019.4 or 2020.3 or try it with option 3. from my last post.

    If you still can't get it to work, we will offer a refund - just send us your invoice via email.
     
  43. musicdeveloper

    musicdeveloper

    Joined:
    Oct 16, 2019
    Posts:
    64
    The issue here would not be getting the build to successfully run after building - it would be uploading a build that successfully runs to the Mac App Store for review. Have you fully tested that process?

    To test that properly, you would need to have the test project be assigned a Bundle Identifier in Player Settings that is different from the Bundle identifier for the File Browser PRO plugin - as it would be for an actual developer submitting to the Mac Store.

    Thank you


     
    Last edited: Nov 15, 2021
  44. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    I sent you an email with a possible fix.
     
  45. Creator-of-1BITDRAGON

    Creator-of-1BITDRAGON

    Joined:
    Jul 19, 2019
    Posts:
    17
    Hi Stefan,

    On Linux, the File Open/Save dialog does not default to the last chosen directory. I tried to pass directory with a variable, like:
    savePath = FileBrowser.Instance.SaveFile("Save File", savePath, name, "txt")
    but it doesn't work on Linux.

    Thanks for your help.
     
  46. Stefan-Laubenberger

    Stefan-Laubenberger

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

    I think the main problem is that the "savePath" contains a file and not only the path.
    However, we made a fix for that case - if you like to test it out, please send us your invoice via email.


    So long,
    Stefan
     
  47. Creator-of-1BITDRAGON

    Creator-of-1BITDRAGON

    Joined:
    Jul 19, 2019
    Posts:
    17
    The fix is working perfectly, thanks!
     
  48. chinmay_chinara

    chinmay_chinara

    Joined:
    May 8, 2017
    Posts:
    2
    HI Stefan,

    first of all great work on the plug-in. Really helpful. I was trying the WebGL_Demo and it shows a missing prefab. Can you help me out with it ? See the image attached.

    Capture.PNG
    Chinmay
     
  49. Stefan-Laubenberger

    Stefan-Laubenberger

    Joined:
    May 25, 2014
    Posts:
    1,823
    Hi Chinmay

    For WebGL, you will need an additional asset called "WebGL Native File Browser":
    https://assetstore.unity.com/packages/slug/41902?aid=1011lNGT

    That should solve the problem.


    All the best,
    Stefan
     
    chinmay_chinara likes this.
  50. Fattie

    Fattie

    Joined:
    Jul 5, 2012
    Posts:
    470
    Cheers Stefan @Stefan-Laubenberger , for February 2022. Is it working trouble free with Monterey macs, both M1 and intel ?

    Thanks for the info, will buy straight away if it's up on modern macs. thank you!
     
unityunity