+2 votes

Hello I have defined in my game that when the ESCAPE key is pressed, the game scene is changed and the player is asked if you want to leave the game. When I press no, the scene loads again, but not progress to be save, but I want the game progress to be saved.

in Engine by (181 points)

If you switch scene, it means you're removing the current scene. If you don't save the state of that scene, you'll be back to your initial state when you switch back. You could implement a temporary scene save file when switching to your menu scene, or you could take the followong simpler approach:

  • when the use press ESC, pause the game (see the official docs for that)
  • show the menu scene over your current scene, instead of switching
  • when the user press no, remove the menu scene and unpause the game

This way, you don't have to save/load everytime you want to show a menu.

Where is this tutorial in the Godot document?

Thank youuuu my brother

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.