gkngkc / UnityStandaloneFileBrowser

A native file browser for unity standalone platforms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mac app crashes when I press CANCEL in Open File dialog

hippogamesunity opened this issue · comments

Hi! This only happens on Mac, and it works fine on other platforms. This doesn't happen in editor. Unfortunately, I don't know how to get any debug info from Mac apps.

The same problem but it happens also in the editor for me...

Maybe I solved the problem...
Pressing "Cancel" the callback is called passing an empty string as path; before doing anything in the callback just check if the "path" is not empty, otherwise return:

                    StandaloneFileBrowser.SaveFilePanelAsync("Save File", "", name, "i4t", (string path) => {

                        if(string.IsNullOrEmpty(path))
                            return;

                        StreamWriter writer = new StreamWriter(path, true);
                        writer.WriteLine(persisted);
                        writer.Close();
                    });

I perform this check, it doesn't help.