Godot Version
4.5 windows
Question
I’m currently working on a game with a main menu. The menu contains 3 buttons, two of them change the scene to a game area and a settings menu respectively, and the other exits the game. They all work in the editor but not after export.
here’s the output of the log file after launching the game from console:
Godot Engine v4.5.stable.official.876b29033 - https://godotengine.org
WARNING: Unable to initialize Windows common controls. Native dialogs may not work properly.
at: DisplayServerWindows (platform/windows/display_server_windows.cpp:6940)
OpenGL API 3.3.0 NVIDIA 573.44 - Compatibility - Using Device: NVIDIA - NVIDIA T550 Laptop GPU
ERROR: Can’t load dependency: ‘res://scenes/main_menu.tscn’.
at: (core/io/resource_format_binary.cpp:459)
ERROR: Error when trying to parse Variant.
at: (core/io/resource_format_binary.cpp:503)
ERROR: Error when trying to parse Variant.
at: (core/io/resource_format_binary.cpp:490)
ERROR: Failed loading resource: res://.godot/exported/133200997/export-7416c78d345eded4b396246a6c8adbe0-settings.scn.
at: (core/io/resource_loader.cpp:343)
SCRIPT ERROR: Parse Error: Could not preload resource file “res://scenes/settings.tscn”.
at: GDScript::reload (res://scripts/main_menu.gd:7)
ERROR: Failed to load script “res://scripts/main_menu.gd” with error “Parse error”.
at: load (modules/gdscript/gdscript.cpp:3041)
this is what the code of my main menu scene looks like:
extends Control
@export var play_scene: PackedScene
#@export var settings_scene: PackedScene
#const play_area = "res://scenes/GameSystem.tscn"
var game_scene = preload("res://scenes/GameSystem.tscn").instantiate()
var settings_scene = preload("res://scenes/settings.tscn").instantiate()
func _on_play_button_pressed() -> void:
#get_tree().change_scene_to_packed($SceneHandler.scene1)
get_tree().root.add_child(game_scene)
get_tree().current_scene = game_scene
queue_free()
func _on_settings_button_pressed() -> void:
get_tree().root.add_child(settings_scene)
get_tree().current_scene = settings_scene
queue_free()
func _on_exit_button_pressed() -> void:
get_tree().quit()
Changing the root scene to settings makes every button work properly except for the “settings” button in the main menu, which changes the game to an empty scene.
I checked and there’s no pausing or case sensitivity shenanigans going on.
