Skip to main content

Godot - Scene Switching

·29 words
icysamon
Author
icysamon
Electronics & Creator
# Godot 4.1

var simultaneous_scene = preload("res://Scene/Test.tscn").instantiate() # Scene loader


func _ready():
    start = get_node("ButtonPosition/Home/Start/Button") # Get the button
    start.pressed.connect(self.button_pressed) # Connect signal


func button_pressed():
    get_tree().root.add_child(simultaneous_scene) # Switch scene