My code :
using System.Windows.Forms; this is unity mono forms
OpenFileDialog open = new OpenFileDialog();
open.ShowDialog();
My code :
using System.Windows.Forms; this is unity mono forms
OpenFileDialog open = new OpenFileDialog();
open.ShowDialog();
Yet another alternative:
Copy System.Windows.Forms.dll from Unity_Location\Editor\Data\Mono\lib\mono\2.0 to a Plugins folder in your project.
In your script :
using System.Runtime.InteropServices;
public class myClass{
[DllImport("user32.dll")]
private static extern void SaveFileDialog(); //in your case : OpenFileDialog
private void myMethod()
{
System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
//your code
}
}
use player setting .net not .net subset
The best thing to do is code a plugin that does this now that all versions of Unity support plugins. You can easily make this multi-platform for all computer OSes by using defines and setting the correct dll/bundle to load.
I’ve just made a plugin for OSX and it works great. Just make sure you build a universal bundle if you plan on making your game run on a 32bit machine.
An alternative way: See my answer for Equivalent of OpenFilePanel without using UnityEditor? - Unity Answers