Client/scripts/ui/switch_to_scene.gd

15 lines
304 B
GDScript3
Raw Normal View History

2025-01-29 13:43:42 +01:00
extends Button
2025-02-12 13:50:15 +01:00
@export var scene_name: String
2025-01-29 13:43:42 +01:00
func _ready() -> void:
connect("pressed", _on_Button_pressed)
func _on_Button_pressed() -> void:
2025-02-12 13:50:15 +01:00
if not scene_name:
2025-01-29 13:43:42 +01:00
push_error("Scene to switch to is not configured")
2025-02-12 13:50:15 +01:00
return
get_tree().change_scene_to_file("res://scenes/" + scene_name + ".tscn")