mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-21 06:27:29 -05:00
fix EditorUtility.OpenFilePanel
This commit is contained in:
parent
66e993fa5f
commit
bf5eee2fba
|
|
@ -15,7 +15,14 @@ namespace UniGLTF
|
|||
|
||||
public static void ImportGltfFileToGameObject()
|
||||
{
|
||||
var path = EditorUtility.OpenFilePanel("open glb", "", "gltf,glb,zip");
|
||||
var path = EditorUtility.OpenFilePanel("open glb", "",
|
||||
#if UNITY_EDITOR_OSX
|
||||
// https://github.com/vrm-c/UniVRM/issues/1837
|
||||
"glb"
|
||||
#else
|
||||
"gltf,glb,zip"
|
||||
#endif
|
||||
);
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ namespace UniGLTF.GltfViewer
|
|||
#if UNITY_STANDALONE_WIN
|
||||
return VRMShaders.PathObject.FromFullPath(FileDialogForWindows.FileDialog(title, extensions));
|
||||
#else
|
||||
Debug.LogWarning("Non-Windows runtime file dialogs are not yet implemented.");
|
||||
return default;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ namespace VRM.SimpleViewer
|
|||
public static string OpenFileDialog(string title, params string[] extensions)
|
||||
{
|
||||
#if UNITY_STANDALONE_WIN
|
||||
return FileDialogForWindows.FileDialog("open VRM", "vrm", "bvh");
|
||||
return FileDialogForWindows.FileDialog(title, extensions);
|
||||
#elif UNITY_WEBGL
|
||||
// Open WebGLFileDialog
|
||||
// see: Assets\VRM_Samples\SimpleViewer\Plugins\OpenFile.jslib
|
||||
|
|
@ -15,9 +15,11 @@ namespace VRM.SimpleViewer
|
|||
#elif UNITY_EDITOR
|
||||
// EditorUtility.OpenFilePanel
|
||||
// TODO: How to specify multiple extensions on OSX?
|
||||
return UnityEditor.EditorUtility.OpenFilePanel("Open VRM", "", "vrm");
|
||||
// https://github.com/vrm-c/UniVRM/issues/1837
|
||||
return UnityEditor.EditorUtility.OpenFilePanel(title, "", extensions[0]);
|
||||
#else
|
||||
// fall back constant path
|
||||
Debug.LogWarning("Non-Windows runtime file dialogs are not yet implemented.");
|
||||
return Application.dataPath + "/default.vrm";
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user