2
Good morning guys, I’m having a question at Godot to get back to the last scene. Should work as the "Continue" button after pausing the game.
I have a menu of options that is accessed when the user clicks pause. Now I need that by clicking a specific button on that menu, it goes back to the last scene that was.
/The game works as an interactive book, so there is no need to store a character’s data, for example. Just go back to the last scene/page./
I’m using this code here and it hasn’t worked:
extends Button
var saved = null
func save_current_scene():
saved = get_tree().get_current_scene()
func reload_last_saved():
get_tree().set_current_scene(saved)
func _on_Button_Pressed():
get_tree().change_scene(saved)
I have tried to find other ways on the internet to do it, but they always use a Node and not a button. I tried to do it manually by changing these codes but I was still unsuccessful. I wish someone would let me know what I’m doing wrong.
Thank you in advance,