pkdawson / imgui-godot

Dear ImGui plugin for Godot 4
MIT License
318 stars 18 forks source link

Crash when using imgui-godot on Mac (M1) #67

Closed MikeOnDeck closed 1 week ago

MikeOnDeck commented 1 week ago

Hi there, I just thought I'd try the imgui plugin in my simple project, and as soon as I either call ImGui.Begin() or ImGui.ShowDemoWindow(), the game crashes on startup. I simply have:

func _process(delta):
    ImGui.ShowDemoWindow()

To clarify, I installed the plugin from inside the editor using AssetLib, and restarted the editor multiple times and the problem always seems to still arise.

Attached Crash Log.txt is from the log I received from the crash.

Godot Version v4.2.2.stable.mono.official [15073afe3]

Addon version: v5.1.3 (installed from AssetLib in editor)

pkdawson commented 1 week ago

Make sure you've enabled the plugin in Project > Project Settings > Plugins.

It's an easy thing to miss, and I've yet to find a good way to warn about it at runtime. If you run your project from the terminal (using /Applications/Godot.app/Contents/MacOS/Godot), you should see an error like:

ERROR: IM_ASSERT g.WithinFrameScope (imgui/imgui.cpp:6874)

Unfortunately this error doesn't show up in the editor.

MikeOnDeck commented 1 week ago

That's exactly it. Apologies for the inconvenience on this one, that should have been so obvious. It's kind of weird how Godot imports plugins but appears to disable them by default.

In any case, it's all working now, thanks so much and appreciate the explanation too.

As a side note: it's absolutely awesome to see ImGui running so easily in Godot. I've used ImGui on multiple other projects in the past for other engines so it's great to see it running so well and so easy to set up here. Appreciate all the work from your team!