Godot plugin for integrating Dear ImGui
Still a work in progress, some unfinished stuff, not sure about the interface, probably bugs, resource leaks, etc
On Windows, just click Build
in the top right then play the project. On other platforms, you may need to
run nuget restore
, then try the build again.
-
Create a project and click
Build
in the top right to generate the .csproj file. -
Install the plugin by copying over the
addons
folder. -
Enable the plugin in
Project > Project Settings > Plugins
. -
In Visual Studio or another IDE, open the solution and allow unsafe blocks in all configurations, and install
ImGui.NET
with NuGet. Save and return to Godot.(If you prefer to manually edit the .csproj instead, refer to the demo csproj for the necessary modifications, or copy it entirely.)
-
Click
Build
again (if you get errors, you probably need to runnuget restore
). -
Add an
ImGuiNode
to your scene. -
Write code!
I've provided two ways to use ImGui. See the demo project scenes for examples.
-
Drop an
ImGuiNode
wherever you want in your scene (usually near the end, so it's rendered on top). -
From a script on any other node (or multiple nodes!), connect the
IGLayout
signal. -
In the function which handles this signal, use
ImGuiNET
to create your GUI.
If you need to override something, or if you just want to do everything with one node:
-
Add the
ImGuiNode
, then useExtend Script
. -
The Godot prompt won't let you inherit from
ImGuiNode
, so be sure to fix that after your new script is created. -
Override
Layout
- seeMyGui.cs
for details. Be careful when overriding other methods; it should be ok if you make sure to call the parent method first (usingbase
).
Since this plugin is unfinished, it doesn't make sense to document an API yet. Check the samples and use the static methods provided by ImGuiGD.
When exporting your project with Godot, the native code cimgui library won't be included. On Windows, you can just copy over cimgui.dll (from .mono\temp\bin\ExportRelease) to the same directory as your exe.
On macOS, I haven't been able to get the .app to work no matter where I put the .dylib. It does work if you run the binary directly.
All code written by Patrick Dawson, released to the public domain (Creative Commons Zero v1.0 Universal)
Godot Logo (C) Andrea Calabró Distributed under the terms of the Creative Commons Attribution License version 3.0 (CC-BY 3.0) https://creativecommons.org/licenses/by/3.0/legalcode.
Hack font distributed under the MIT license
This plugin's functionality relies heavily on ImGui.NET by Eric Mellino