godot-demo-projects/loading/scene_changer/scene_b.gd

9 lines
359 B
GDScript

extends Panel
func _on_goto_scene_pressed() -> void:
# Change the scene to the given PackedScene.
# Though it usually takes more code, this can have advantages, such as letting you load the
# scene in another thread, or use a scene that isn't saved to a file.
var scene: PackedScene = load("res://scene_a.tscn")
get_tree().change_scene_to_packed(scene)