Godot Version
4.3 Stable
Question
The buttons work normally on the main menu scene on start-up. They do not work once I come back to the main menu scene from the level scene.
I am using the following as a script for the main menu:
extends CanvasLayer
const ERROR_CODE_DEFAULT = 0;
const LEVEL_PATH = "res://Scenes/World Scenes/Idle Prototype.tscn"
func _on_start_button_up() -> void:
get_tree().change_scene_to_file(LEVEL_PATH);
func _on_exit_button_up() -> void:
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
get_tree().quit(ERROR_CODE_DEFAULT)
Here is the part of code where I load the main menu again from the level, which I am guessing may be where I am going wrong?
func _on_resume_button_up() -> void:
$CanvasLayer/PauseMenu.hide()
get_tree().paused = false
print("a")
func _on_pause_button_button_up() -> void:
$CanvasLayer/PauseMenu.show()
get_tree().paused = true
print("a")
func _on_exit_to_desktop_button_up() -> void:
get_tree().root.propagate_notification(NOTIFICATION_WM_CLOSE_REQUEST)
get_tree().quit(ERROR_CODE_DEFAULT)
func _on_exit_to_menu_button_up() -> void:
get_tree().change_scene_to_file("res://Scenes/UI Scenes/MainMenu.tscn");
type or paste code here
Is there something I am doing wrong with get_tree() and my SceneTree to prevent the UI elements sending signals to the first code snippet above?
Thank you.