Dear ImGui is a popular library for rapidly building tools for debugging and development. This plugin allows you to use ImGui in Godot with C# (with the aid of ImGui.NET), C++, and GDScript.
After installing the plugin, usage is as simple as this:
public partial class MyNode : Node
{
public override void _Process(double delta)
{
ImGui.Begin("ImGui on Godot 4");
ImGui.Text("hello world");
ImGui.End();
}
}
extends Node
func _process(delta):
ImGui.Begin("My Window")
ImGui.Text("hello from GDScript")
ImGui.End()
If you only need C# support with basic features, you can use the csharp-only
package. Otherwise,
download the full package which includes GDExtension binaries.
You can also find Dear ImGui for Godot in the Asset Library.
-
Create a project and, if you haven't already added some C# code, use
Project > Tools > C# > Create C# solution
. -
Install the plugin by copying over the
addons
folder. Or use GodotEnv. -
In Visual Studio or another IDE, open the solution and allow unsafe code, and install
ImGui.NET
with NuGet. Set your target framework to .NET 8 or later. Save and return to Godot.(If you prefer to manually edit the .csproj instead, refer to the demo csproj for the necessary modifications.)
Important
If you are using the GDExtension, you must use a version of ImGui.NET which matches the version that the GDExtension was built with.
-
Back in the Godot editor, click
Build
. -
Enable the plugin in
Project > Project Settings > Plugins
.
-
Install the plugin by copying over the
addons
folder from the full package which includes the GDExtension. -
Enable the plugin in
Project > Project Settings > Plugins
.
In any Node's _Process
method, use ImGuiNET
to create your GUI. Just don't set the ProcessPriority
in any of your Nodes to either int.MinValue
or int.MaxValue
.
You can also connect to the imgui_layout
signal, and use ImGui in the method which handles that signal. This is strongly recommended if you're using process thread groups in Godot 4.1 or later.
ImGuiGD.Connect(OnImGuiLayout);
If you want to customize fonts or other settings, cr