Tested versions
- Reproducible in: v4.3.dev4.mono.official [df78c06], v4.3.dev5.mono.official [89f70e9]
- Not occurring in v4.3.dev3.mono.official [36e943b], or v4.2.
System information
Godot v4.3.dev5.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 570 Series (Advanced Micro Devices, Inc.; 31.0.14057.5006) - AMD Ryzen 7 5700X 8-Core Processor (16 Threads)
Issue description
What's intended is to use a dictionary of preloaded scenes as a source to load up in-game menus from, like below:
var scenes: Dictionary = {
'ExampleMenu': preload('res://example_menu.tscn'),
'ExampleMenuTwo': preload('res://example_menu_2.tscn')
}
This is stored inside of the "MenuManager" scene's only script, and is made globally accessible by having a global.gd autoload declare the following:
extends Node
var menu_manager: MenuManager
...and then have the MenuManager scene assign itself in its _enter_tree() function:
func _enter_tree() -> void:
Global.menu_manager = self
print(self)
print(Global.menu_manager)
As early as 4.3 snapshot 4, trying to access this dictionary from a scene that is itself preloaded in said dictionary, such as with the line var inst: Control = Global.menu_manager.scenes['ExampleMenuTwo'].instantiate(), this starts causing the Parser Error: Could not resolve member "scenes". error which prevents the game from running. If, in this case, ExampleMenu is removed from the definition of scenes, then everything works as normal.
Steps to reproduce
Create two scenes to test with, and in another scene / script, define a dictionary including both of them.
var scenes: Dictionary = {
'ExampleMenu': preload('res://example_menu.tscn'),
'ExampleMenuTwo': preload('res://example_menu_2.tscn')
}
Have a script within example_menu.tscn - attached to any node within the scene - that tries to access this dictionary.
func _on_button_pressed() -> void:
assert(Global.menu_manager)
assert(Global.menu_manager.scenes)
var inst: Control = Global.menu_manager.scenes['ExampleMenuTwo'].instantiate()
add_child(inst)
This will cause the parser error.
Minimal reproduction project (MRP)
4.3d5-dictionary-bug.zip
Production edit: added gdscript highlighting
Tested versions
System information
Godot v4.3.dev5.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 570 Series (Advanced Micro Devices, Inc.; 31.0.14057.5006) - AMD Ryzen 7 5700X 8-Core Processor (16 Threads)
Issue description
What's intended is to use a dictionary of preloaded scenes as a source to load up in-game menus from, like below:
This is stored inside of the "MenuManager" scene's only script, and is made globally accessible by having a
global.gdautoload declare the following:...and then have the MenuManager scene assign itself in its
_enter_tree()function:As early as 4.3 snapshot 4, trying to access this dictionary from a scene that is itself preloaded in said dictionary, such as with the line
var inst: Control = Global.menu_manager.scenes['ExampleMenuTwo'].instantiate(), this starts causing theParser Error: Could not resolve member "scenes".error which prevents the game from running. If, in this case,ExampleMenuis removed from the definition ofscenes, then everything works as normal.Steps to reproduce
Create two scenes to test with, and in another scene / script, define a dictionary including both of them.
Have a script within
example_menu.tscn- attached to any node within the scene - that tries to access this dictionary.This will cause the parser error.
Minimal reproduction project (MRP)
4.3d5-dictionary-bug.zip
Production edit: added gdscript highlighting