[Unity3D] How to Open WinForm window in Unity
1. Create a new ClassLibrary project in your Unity Visual Studio Solution.
2. Set the project target framework to ".NET Framework 2.0".
3. Create new WinForm class and write your code that you need in the new ClassLibrary project(see below sample code).
4. Build the project and copy target dll file to your Unity Assets\Managed folder.
5. Copy System.Windows.Forms.dll File in [%Unity Folder%\Editor\Data\MonoBleedingEdge\lib\mono\gac\System.Windows.Forms\2.0.0.0__b77a5c561934e089] folder to your Unity Assets\Managed folder.
6. Use the new ClassLibrary dll file in your Unity script(see below sample code).
== In the ClassLibary Project ==
public class WinformTest
{
public void ShowDialog()
{
InputForm form = new InputForm();
form.ShowDialog();
}
}
== In the Unity Project script ==
using UnityEngine;
using System.Collections;
using [Your ClassLibrary]; // <------------------------
public class NewBehaviourScript : MonoBehaviour {
// Use this for initialization
WinformTest winformTest;
void Start () {
winformTest = new WinformTest();
winformTest.ShowDialog();
}
// Update is called once per frame
void Update () {
}
}