Skip to content
Patrick Dawson edited this page Jun 20, 2024 · 5 revisions

Note

This page applies to imgui-godot v6.0.0 or later.

There are a few issues to be aware of when exporting projects. This plugin currently only supports Windows (x64), macOS (x64/arm64), and Linux (x64). For any other platform, all ImGui-related code needs to be disabled.

First, you can choose whether to include the addon itself in your export within each preset:

image

Second, you'll need to conditionally disable your own code which calls ImGui if you're exporting without imgui-godot included:

GDScript

if Engine.has_singleton("ImGuiAPI"):
    var ImGui: Object = Engine.get_singleton("ImGuiAPI")
    ImGui.Begin("hello")
    ImGui.End()

This is an imperfect solution, but it's basically what GodotSteam recommends as well. There are a couple drawbacks:

  • You'll get a warning (SHADOWED_GLOBAL_IDENTIFIER). To suppress these, set debug/gdscript/warnings/shadowed_global_identifier to Ignore.
  • Code completion for ImGui won't work. When you're working on your code in that block, you can just temporarily comment out the var ImGui line.

C#

Set up a conditional compilation symbol (DefineConstants) appropriately, and use the preprocessor like:

#if IMGUI
ImGui.Begin("hello");
ImGui.End();
#endif

CSharpGameProject.csproj - This sample covers the common scenario where you want ImGui available on desktop platforms in the editor and in debug exports, but not in release exports.

C++

Basically the same thing as C#. Add a define in SCons/CMake. Don't include the imgui sources in your release build.

Clone this wiki locally