Description
Tested versions
System information
Godot v4.4.stable - Windows 11 (build 26100) - Multi-window, 1 monitor - Vulkan (Forward+) - integrated Intel(R) UHD Graphics - Intel(R) Core(TM) i5-1035G1 CPU @ 1.00GHz (8 threads)
Issue description
When a Theme
is set as the default theme (using the project setting gui/theme/custom
), and a custom resource is set as the value of one of its icons, if that custom resource uses an autoload anywhere, the parser will say that the autoload does not exist. In a bit more detail:
Say we have an autoload named Autoload
, and a custom resource defined as follows:
extends Texture2D
class_name CustomIcon
func _init() -> void:
Autoload # we get a warning about this line not doing anything but this attempts to access the autoload
We now create a Theme
and add an instance of the above resource as the value of an icon. We set the Theme
as the default theme using gui/theme/custom
in the project settings.
If we now try to run the game, we will be treated with a parser error saying Parser Error: Identifier not found: Autoload
. In addition, we get errors saying debug: Condition "_try_capture(command, data, captured) != OK" is true. Continuing.
.
This crash can also occur when the custom resource doesn't directly use an autoload, since my main project currently suffers from that (though it is on 4.2.2
), probably when the resource indirectly loads a script that does use an autoload.
I presume the parser error occurs because the resource's script is parsed before the autoloads are loaded. The other errors probably occur because the game crashes before Godot is able to properly load the debugger (I've had this error before where it was caused by a breakpoint in a specific location, removing the breakpoint removed the errors).
Steps to reproduce
See above or the MRP