Godot change scene error

Godot Version

4.3

Question

Hey yall quick question. I am using change scene to change scenes from my main menu to the game. Now I’ve triple checked my hierarchy and such and the paths. My quit button works and when I use my start button it prints to the console. It however will not change the actual scene and it gives me "non existent function “change_scene_” in base scenetree.
My code:


func _ready():
	# Connect signals
	$StartButton.pressed.connect(_on_StartButton_pressed)
	$QuitButton.pressed.connect(_on_QuitButton_pressed)

func _on_StartButton_pressed():
	#print("Start Button Pressed")  # Debugging print
	get_tree().change_scene("res://game.tscn")  # Load Test Scene

func _on_QuitButton_pressed():
	print("Quit Button Pressed")  # Debugging print
	get_tree().quit()

This function doesn’t exist anymore in Godot 4, now is SceneTree.change_scene_to_file() (what you want) and SceneTree.change_scene_to_packed()

2 Likes

Bless you brother

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.