button_change_scene.gd 229 B

12345678910111213
  1. extends Button
  2. @export_file var scene_to_change_to: String = ""
  3. func _ready():
  4. pressed.connect(change_scene)
  5. func change_scene():
  6. if not scene_to_change_to.is_empty():
  7. get_tree().change_scene_to_file(scene_to_change_to)