From de25ceb98e98f496bd36cf1088dfe2d2812c8488 Mon Sep 17 00:00:00 2001 From: Patrick Dawson Date: Mon, 1 Jul 2024 03:14:38 +0200 Subject: [PATCH] Fix loading ImGuiConfig (C# implementation) --- addons/imgui-godot/ImGuiGodot/ImGuiController.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/addons/imgui-godot/ImGuiGodot/ImGuiController.cs b/addons/imgui-godot/ImGuiGodot/ImGuiController.cs index c642e0f..7e338e5 100644 --- a/addons/imgui-godot/ImGuiGodot/ImGuiController.cs +++ b/addons/imgui-godot/ImGuiGodot/ImGuiController.cs @@ -41,18 +41,12 @@ public override void _EnterTree() if (ResourceLoader.Exists(cfgPath)) { cfg = ResourceLoader.Load(cfgPath); - bool cfgok = false; - foreach (var d in cfg.GetPropertyList()) - { - if (d.TryGetValue("name", out var name) && (string)name == "ImGuiConfig.gd") - { - cfgok = true; - } - } + float scale = (float)cfg.Get("Scale"); + bool cfgok = scale > 0.0f; if (!cfgok) { - GD.PushError($"imgui-godot: config not an ImGuiConfig resource: {cfgPath}"); + GD.PushError($"imgui-godot: config not a valid ImGuiConfig resource: {cfgPath}"); cfg = null; } }