From 91594fae012377609efe7da6c030b6943708cf91 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 29 Jan 2025 13:36:54 +0900 Subject: [PATCH 1/2] fix order. "UNITY_EDITOR" first --- Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs b/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs index cd788bb7a..827bfd6b3 100644 --- a/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs +++ b/Assets/VRM10_Samples/VRM10Viewer/VRM10ViewerUI.cs @@ -645,7 +645,9 @@ namespace UniVRM10.VRM10Viewer string FileDialog() { -#if UNITY_STANDALONE_WIN +#if UNITY_EDITOR + return UnityEditor.EditorUtility.OpenFilePanel("Open VRM", "", "vrm"); +#elif UNITY_STANDALONE_WIN return VRM10FileDialogForWindows.FileDialog("open VRM", "vrm"); #elif UNITY_WEBGL // Open WebGL_VRM10_VRM10Viewer_FileDialog @@ -653,8 +655,6 @@ namespace UniVRM10.VRM10Viewer WebGL_VRM10_VRM10Viewer_FileDialog("Canvas", "FileSelected"); // Control flow does not return here. return empty string with dummy return null; -#elif UNITY_EDITOR - return UnityEditor.EditorUtility.OpenFilePanel("Open VRM", "", "vrm"); #else return Application.dataPath + "/default.vrm"; #endif From cbf5f336665398e619bf4a80283af714ce40750d Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 29 Jan 2025 13:39:38 +0900 Subject: [PATCH 2/2] UNITY_EDITOR first --- .../VRM_Samples/SimpleViewer/FileDialog/FileUtil.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/VRM_Samples/SimpleViewer/FileDialog/FileUtil.cs b/Assets/VRM_Samples/SimpleViewer/FileDialog/FileUtil.cs index 49455fc6c..1baf5fe7f 100644 --- a/Assets/VRM_Samples/SimpleViewer/FileDialog/FileUtil.cs +++ b/Assets/VRM_Samples/SimpleViewer/FileDialog/FileUtil.cs @@ -4,7 +4,12 @@ namespace VRM.SimpleViewer { public static string OpenFileDialog(string title, params string[] extensions) { -#if UNITY_STANDALONE_WIN +#if UNITY_EDITOR + // EditorUtility.OpenFilePanel + // TODO: How to specify multiple extensions on OSX? + // https://github.com/vrm-c/UniVRM/issues/1837 + return UnityEditor.EditorUtility.OpenFilePanel(title, "", extensions[0]); +#elif UNITY_STANDALONE_WIN return FileDialogForWindows.FileDialog(title, extensions); #elif UNITY_WEBGL // Open WebGL_VRM0X_SimpleViewer_FileDialog @@ -12,11 +17,6 @@ namespace VRM.SimpleViewer WebGLUtil.WebGL_VRM0X_SimpleViewer_FileDialog("Canvas", "FileSelected"); // Control flow does not return here. return empty string with dummy return ""; -#elif UNITY_EDITOR - // EditorUtility.OpenFilePanel - // TODO: How to specify multiple extensions on OSX? - // https://github.com/vrm-c/UniVRM/issues/1837 - return UnityEditor.EditorUtility.OpenFilePanel(title, "", extensions[0]); #else // fall back constant path UnityEngine.Debug.LogWarning("Non-Windows runtime file dialogs are not yet implemented.");