Standalone File Browser

Hi everyone,

I wrote a simple wrapper for Windows/Mac native file dialogs. Works in editor and runtime.

Features:

  • Open file/folder, save file dialogs supported.
  • Multiple file selection.
  • File type filter

You can check it out here: GitHub - gkngkc/UnityStandaloneFileBrowser: A native file browser for unity standalone platforms

Cheers!

13 Likes

hi there!

it really looks nice but there are so many things on it that i dont need. i only want the save file as txt option.
i cant get it to work without all the other parts and scripts. is there a faster way of doing this instead of using all the options/scripts???

thanks alot,
kelvin

1 Like

Hi,

I’m not sure what do you mean by other parts and scripts but simplest way to set extension is like this;

var path = StandaloneFileBrowser.SaveFilePanel(“”, “”, “”, “txt”);

But its just a syntactically simplified version, creates a new filter extension array under the hood.

okay i fixed it by removing almost every thing (code for the mac and codes for the “open file” option. now i can use it again.

but i have another question. it doesnt actualy save a file. how and where can i set the data that it should save?

thanks alot for standalone file browser btw!!! it looks really good

Yes it won’t save anything, its just returns selected path. You need to save file by yourself, like;

System.IO.File.WriteAllText(path, yourText);

You’re welcome. I’m glad it helped

okay thanks alot!!!

sorry but im back. i want to force that it opens the directory of the .EXE (yes i know how to do this) but where in your script could i do that?

also may i ask what these mean:
the " " after the “save file”?
the extentionList?
in this part of the code:

 _path = StandaloneFileBrowser.SaveFilePanel("Save File", "", "MySaveFile", extensionList);

thanks alot!

is there a way of the browser to work in full screen mode?

Hi, thank your for great package!

I’m using StandaloneFileBrowser.OpenFilePanel to load a file in an Unity Windows Standalone App.
There is one problem: when I use my program in “fullscreen”, after return from OpenFileDialog, Windows does’nt return to my program, just shows the Windows desktop.
The user needs to find my program in the taskbar and click it.

This may not be a great thing for “normal” users, but my app is used by mentally disabled people, every interrupt of flow is difficulty.

How can I bring my Unity program back to front after opening a file?

Hi,

I did some fixes for windows fullscreen support. You can check last commit.

Thanks

1 Like

Great! Works perfect!

1 Like

Hi

I’m trying to get it to compile, but no matter what I try, Unity won’t accept the scripts.

Even though VS can see the ass. refs., unity won’t. How can I fix it??

I’m using Unity 5.5.2f1/VS 2017.

Hi,

I’m not sure but probably its because of plugins. Be sure Ookii.Dialogs.dll and System.Windows.Forms.dll platform dependencies are correct, Editor & Standalone ( Windows ) settings should checked

Sorry, didn’t see your reply before now…

Hmm…I’m not really sure what you mean. How do I check it? I’ve placed the dll’s in Assets\plugins\StandaloneFileBrowser\Plugins (including the entire project). Is that what’s wrong?

I want to use this in my project using the Simple Node Editor by Seneral: https://forum.unity3d.com/threads/simple-node-editor.189230

No, directory of dll’s shouldn’t be a problem. I was talking about import settings

3062757--230164--sfb.jpeg

But again, i’m just guessing the problem. If you can write the error message, i’ll try to understand what’s wrong.

Ah, ok! Lol, didn’t even know that was something I had to deal with. :smile:

Anyway, I changed the settings to match your pic. But as you can see, it still gives me errors. Though it’s a new kind! I haven’t seen those before…?

Hmm, i really don’t know what’s going on never see this error before, looks like some project issue. Maybe you can try removing all file browser files and re-import package

Hum, I just noticed that I had the files in two folders. So I deleted one of them and got rid of the warnings, but not the errors.

Hmm…closed VS, did a reimport, and now it compiles! Yay. :slight_smile:

Ok, so I’m using this:

WriteResult(StandaloneFileBrowser.OpenFilePanel("Open File", "", extensions, true));

                Debug.Log("_path: '" + _path + "'");

And the output_log shows this:
_path: 'C:\Udvikling\custom editor\builds\test\test.hop
’

Yup, that’s a linebreak at the end. But why!? :open_mouth: :smile: It causes my code to break when I use path.getfilname().

I can fix the var myself, but I thought you’d like to know. :slight_smile:

Thanks for the heads up! It’s because of this helper method, default usage should be something like this;

var paths = StandaloneFileBrowser.OpenFilePanel("Open File", "", extensions, true));                
Debug.Log("_path: '" + paths[0] + "'");
2 Likes