Godot Version
func _process(delta):
if _on_first_button_pressed():
Global.transition_scene = true
change_scenes(“res://first.tscn”, “first”)
elif _on_second_button_pressed():
Global.transition_scene = true
change_scenes(“res://second.tscn”, “second”)
elif _on_third_button_pressed():
Global.transition_scene = true
change_scenes(“res://third.tscn”, “third”)
elif _on_fourth_button_pressed():
Global.transition_scene = true
change_scenes(“res://fourth.tscn”, “fourth”)
elif _on_fifth_button_pressed():
Global.transition_scene = true
change_scenes(“res://fifth.tscn”, “fifth”)
func _on_first_button_pressed():
return true
func _on_second_button_pressed():
return true
func _on_third_button_pressed():
return true
func _on_fourth_pressed():
return true
func _on_fifth_button_pressed():
return true
Question
I’m trying to make an app and I need to switch scenes on the click of a button, but when it’s run it’s as if the button is instantly pressed and the scene is instantly switched. I’m using the _on_button_pressed connection and when it’s pressed it returns true and in _process, it checks if each _on_button_pressed function returns true, and will then switch scenes, and the switching seems to work.