-
Notifications
You must be signed in to change notification settings - Fork 29
Export
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:
Second, you'll need to conditionally disable your own code which calls ImGui if you're exporting without imgui-godot included:
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, setdebug/gdscript/warnings/shadowed_global_identifier
toIgnore
. - Code completion for
ImGui
won't work. When you're working on your code in that block, you can just temporarily comment out thevar ImGui
line.
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.
Basically the same thing as C#. Add a define in SCons/CMake. Don't include the imgui sources in your release build.