Skip to content
C. K edited this page Aug 1, 2020 · 1 revision

Setup Empty Form

This is an expanded guide on the steps to get a basic form up and running.

Import Plugin

Import the Unity-WinForms plugin and install it.

  • Download Unity-WinForms.unitypackage.
  • Import to your Unity project by opening the file.
  • Assets\Unity-WinForms should now exist in your project.

Create GameObject

  • Create an empty GameObject, I called it WinForm.

Attach Form

  • Attach the UnityWinForms script to the WinForm GameObject. Path to UnityWinForms script \Assets\Unity-WinForms\Unity\UnityWinForms.cs

Add Fonts

  • On the WinForm GameObject, expand Resources/Fonts, select a size and add Arial to element 0. This will remove font errors.

Create Form

  • Create a new C# script WinForm.cs.
using UnityEngine;
using System.Windows.Forms;
public class WinForm : MonoBehaviour
{
void Start()
{
var form = new Form();
form.Show();
// Or show a message.
//// MessageBox.Show("Hello World.");
}
}
  • Attach WinForm.cs to WinForm GameObject.

Run

All items in the form has to be added by code. By running your Unity application an empty form should now show up.