Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot Editor crashes with ImGui under [Tool] nodes #81

Closed
jasonswearingen opened this issue Aug 26, 2024 · 3 comments
Closed

Godot Editor crashes with ImGui under [Tool] nodes #81

jasonswearingen opened this issue Aug 26, 2024 · 3 comments

Comments

@jasonswearingen
Copy link

runs "in game" fine.

When creating a simple project with this as the script for the loading scene, it crashes.

using Godot;
using System;
using ImGuiNET;

[Tool]
public partial class Hello : Node3D
{
	public override void _Process(double delta)
	{
		ImGui.Begin("ImGui on Godot 4");
		ImGui.Text("hello world Test");
		ImGui.End();
	}
}

Crashes on the first line with

System.AccessViolationException
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

image

Crashes the editor upon startup until rebuilding the csharp code with the ImGui lines commented out.

Ideally I would be able to use ImGui in the editor via [Tool] nodes, just like in-game.

specs:

  • Win11
  • Godot 4.3.stable.mono
  • ImGui v1.91.0.1 via Nuget
  • ImGui-Godot as of today (via repo)
@jasonswearingen
Copy link
Author

I see in #58 the use of ToolInit(). I tried adding that:

	private bool isImGuiInit = false;
	public override void _Ready()
	{
		base._Ready();
		isImGuiInit = ImGuiGD.ToolInit();
	}

but it always returns false (including when I try recalling it from _Process()). This always returns false both in the editor and when running in debug.

@jasonswearingen
Copy link
Author

jasonswearingen commented Aug 26, 2024

I got it "working" (not crashing).... I used the addon folder from the git repo, not the releases. switching to releases now works.

image

Repository owner deleted a comment Aug 26, 2024
@pkdawson
Copy link
Owner

Yes, using ImGui in the editor is one feature that absolutely requires the GDExtension.

https://github.com/pkdawson/imgui-godot/wiki/In%E2%80%90editor-GUI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@pkdawson @jasonswearingen and others