UnityStandaloneFileBrowser: [Bug] Didn't open dialog in unity 2023.2

It seem VistaOpenFileDialog are not working in unity 2023, are there any fix?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 30

Most upvoted comments

I have submitted a bug report to Unity regarding this error. Currently under review, there was no problem up to Unity2023.2.0a14, and it was found that an error occurred from Unity2023.2.0a15.

UUM-62035 is included in the Fixes section of the release notes for Unity6000.0.0b15. And sure enough, the dialog comes up and no errors occur.

@achimmihca

diff --git a/Assets/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs b/Assets/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs
index 2bdb8c218..b1e379220 100644
--- a/Assets/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs
+++ b/Assets/StandaloneFileBrowser/StandaloneFileBrowserWindows.cs
@@ -4,7 +4,13 @@ using System;
 using System.IO;
 using System.Windows.Forms;
 using System.Runtime.InteropServices;
+#if UNITY_2023_2_0 || UNITY_2023_2_1 || UNITY_2023_2_2 || UNITY_2023_2_3 || UNITY_2023_2_4 || UNITY_2023_2_5 || UNITY_2023_2_6 || UNITY_2023_2_7 || UNITY_2023_2_8 || UNITY_2023_2_9 || UNITY_2023_2_10 || UNITY_2023_2_11 || UNITY_2023_2_12 || UNITY_2023_2_13 || UNITY_2023_2_14 || UNITY_2023_2_15 || UNITY_2023_2_16 || UNITY_2023_2_17 || UNITY_2023_2_18 || UNITY_2023_2_19
+using VistaOpenFileDialog = System.Windows.Forms.OpenFileDialog;
+using VistaFolderBrowserDialog = System.Windows.Forms.FolderBrowserDialog;
+using VistaSaveFileDialog = System.Windows.Forms.SaveFileDialog;
+#else
 using Ookii.Dialogs;
+#endif
 
 namespace SFB {
     // For fullscreen support

Updated my project to 2023.2.20f1 and I confirm the issue is gone for me 😀

Unity2023.2.20 also contains UUM-62035 in the Fixes section.

“Fixed in 6000.0.0b14” and “Fix In Review for 2023.2.20f1” on issue tracker

@anonymous2585 I tried it with Unity2023.2.12f1 and the dialog worked. This is that Unity project. https://www.dropbox.com/t/52h90sq5zGbxrvvf

“In progress” on issue tracker🙏

Perhaps https://github.com/Unity-Technologies/mono/pull/2003 will fix it.

Yes, that is exactly what that PR fixes 😃.

@anonymous2585 Yes, unfortunately in the mono version of FileDialog, the AutoUpgradeEnabled property does not work, so the old style dialog is displayed. https://github.com/Unity-Technologies/mono/blob/unity-main/mcs/class/System.Windows.Forms/System.Windows.Forms/FileDialog.cs#L387-L392 Therefore, you have two options: use Unity 2023.1 or earlier, or wait until the bug is fixed.

Also, the mono version of System.Windows.Forms.dll exists in the following path.

[Unity installed folder]\Editor\Data\MonoBleedingEdge\lib\mono\gac\System.Windows.Forms\4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll

@zadinvit You can use OpenFileDialog with System.Windows.Forms.dll. However, the old style dialog is displayed.

@Thaina I deleted the Ookii.Dialogs.dll and replaced it with the source, but the same error occurs, so I don’t think it is caused by the dotnet standard update.