mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-08 11:59:26 -05:00
fix EditorUtility.SaveFilePanel
This commit is contained in:
@@ -7,6 +7,18 @@ namespace UniGLTF
|
||||
public static class SaveFileDialog
|
||||
{
|
||||
static string m_lastExportDir;
|
||||
|
||||
static string extensionString(string[] extensions)
|
||||
{
|
||||
#if UNITY_EDITOR_OSX
|
||||
// in OSX multi extension cause exception.
|
||||
// https://github.com/vrm-c/UniVRM/issues/1837
|
||||
return extensions.Length > 0 ? extensions[0] : "";
|
||||
#else
|
||||
return string.Join(",", extensions);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static string GetPath(string title, string name, params string[] extensions)
|
||||
{
|
||||
string directory = m_lastExportDir;
|
||||
@@ -15,7 +27,7 @@ namespace UniGLTF
|
||||
directory = Directory.GetParent(Application.dataPath).ToString();
|
||||
}
|
||||
|
||||
var path = EditorUtility.SaveFilePanel(title, directory, name, string.Join(",", extensions));
|
||||
var path = EditorUtility.SaveFilePanel(title, directory, name, extensionString(extensions));
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
m_lastExportDir = Path.GetDirectoryName(path).Replace("\\", "/");
|
||||
|
||||
Reference in New Issue
Block a user