示例#1
0
    void OnGUI()
    {
#if UNITY_STANDALONE
        if (GUILayout.Button("打开"))
        {
            Win32FileDialog.FileInfo fileInfo = Win32FileDialog.OpenFileDialog();

            if (fileInfo != null)
            {
                Debug.Log("路径: " + fileInfo.MyPath + "\n 文件名: " + fileInfo.MyName);
            }
            else
            {
                Debug.Log("没打开");
            }
        }

        if (GUILayout.Button("另存"))
        {
            Win32FileDialog.FileInfo fileInfo = Win32FileDialog.SaveFileDialog("ABC", "abc");

            if (fileInfo != null)
            {
                Debug.Log("路径: " + fileInfo.MyPath);
            }
            else
            {
                Debug.Log("没打开");
            }
        }
#endif
    }
示例#2
0
 public void LaunchBrowser(bool audio = true)
 {
     if (browserOpen)
     {
         return;
     }
     browserOpen       = true;
     soundSamples      = audio;
     fileBrowserThread = new Thread(() => Win32FileDialog.ShowWin32FileDialog(audio ? "Import audio files" : "Import image files", audio ? Win32FileDialog.FilterType.AUDIO_FILES : Win32FileDialog.FilterType.IMAGE_FILES));
     fileBrowserThread.Start();
 }