Client/scripts/ui/switch_to_scene.gd

14 lines
259 B
GDScript3
Raw Permalink Normal View History

2025-01-29 13:43:42 +01:00
extends Button
@export var scene: PackedScene
func _ready() -> void:
connect("pressed", _on_Button_pressed)
func _on_Button_pressed() -> void:
if not scene:
push_error("Scene to switch to is not configured")
get_tree().change_scene_to_packed(scene)