From 203eb9e6d7ddd6b5af81dcb7bc23a990f0004d16 Mon Sep 17 00:00:00 2001 From: "mattia.zirpoli" Date: Tue, 25 Nov 2025 21:01:25 +0100 Subject: [PATCH] This checks if the class exists or is a global class before checking if it's virtual or instantiable. It fixes bug #112951. --- editor/editor_node.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 2b1c88fe20c..01da6d5bdd7 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5521,7 +5521,13 @@ Ref EditorNode::_get_class_or_script_icon(const String &p_class, cons } } if (theme.is_valid()) { - bool instantiable = !ClassDB::is_virtual(p_class) && ClassDB::can_instantiate(p_class); + bool instantiable = false; + + // If the class doesn't exist or isn't global, then it's not instantiable + if (ClassDB::class_exists(p_class) || ScriptServer::is_global_class(p_class)) { + instantiable = !ClassDB::is_virtual(p_class) && ClassDB::can_instantiate(p_class); + } + return _get_class_or_script_icon(base_type, "", "", false, p_skip_fallback_virtual || instantiable); } }