button_change_scene.gd 221 B

123456789101112
  1. extends Button
  2. @export_file var scene_to_change_to: String = null
  3. func _ready():
  4. pressed.connect(self.change_scene)
  5. func change_scene():
  6. if scene_to_change_to != null:
  7. get_tree().change_scene(scene_to_change_to)