gkngkc / UnityStandaloneFileBrowser

A native file browser for unity standalone platforms
MIT License
2.01k stars 317 forks source link

Mac app crashes when I press CANCEL in Open File dialog #101

Open hippogamesunity opened 3 years ago

hippogamesunity commented 3 years ago

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.

pupunzi commented 3 years ago

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

pupunzi commented 3 years ago

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();
                    });
hippogamesunity commented 3 years ago

I perform this check, it doesn't help.