美文网首页
unity 调用windows选择文件并导出路径

unity 调用windows选择文件并导出路径

作者: RichMartin | 来源:发表于2019-07-24 10:42 被阅读0次
       System.Windows.Forms.FolderBrowserDialog fbd = null;
           private Thread invokeThread;
           private System.Windows.Forms.DialogResult result;
           public string ChooseFolderPath()
           {
               if(fbd != null)
                   fbd.Dispose();
             
               fbd = new System.Windows.Forms.FolderBrowserDialog();
               fbd.RootFolder = System.Environment.SpecialFolder.MyDocuments;
               fbd.ShowNewFolderButton = true;
               fbd.Description = "选择导出作品路径";
               invokeThread = new Thread(new ThreadStart(InvokeMethod));
               invokeThread.SetApartmentState(ApartmentState.STA);
               invokeThread.Start();
               invokeThread.Join();
               if (result == System.Windows.Forms.DialogResult.OK)
               {
                   fbd.Dispose();
                   return fbd.SelectedPath.ToString();
               }
               else {
                   fbd.Dispose();
                   return "";
               }
           }
    

    相关文章

      网友评论

          本文标题:unity 调用windows选择文件并导出路径

          本文链接:https://www.haomeiwen.com/subject/fkitrctx.html