0 votes

Is It possible to add a script for a save system that would not be connected to a scene, and you could call the save function from any scene?

And to make it so when you reopen the game all of your progress would load?

ex: I finish a level, then you are sent back to the level select page. You close the app then reopen it and all of the levels you have completed would load?

in Engine by (20 points)

1 Answer

+2 votes

It all boils down to saving variables in a file, and reading them back when the game starts (for example, in the first scene, or using an auto-load singleton).
What these variables do to your game is up to you: it can be a list of completed levels, high scores, or more detailed information using dictionaries and arrays.

Loading and saving variables has been covered in many existing questions:
https://godotengine.org/qa/9978/how-do-you-make-save-game?show=9978#q9978
https://godotengine.org/qa/6491/read-%26-write?show=6491#q6491
https://godotengine.org/qa/7764/save-load-directory?show=7764#q7764

by (27,831 points)

And the documentation has a section for saving games.

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 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 webmaster@godotengine.org with your username.