How can i make a simple Save/Load system within the current structure of my game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By EyeBallTank

I tried following a video by DevWorm called “The MOST Simple Way to SAVE DATA in Godot” but with some alterations to suit my case.

One thing i currently want to be saveable/loadable data is the current level.

One reason why this is a big deal is because i have an AutoLoad scene called “scene manager” which is responsible for any scene change and partially due to an animation that occurs before and after a scene is changed.

But right now, it doesn’t seem to work.

These are the relevant scripts in the situation:

https://github.com/EyeBallTank/PROJECT-NORTUBEL-main-ish/blob/main/src/behind_the_scenes/scene_manager.gd The “scene manager” script.

The “scene manager” scene also has an animation called “level_transition_effect” that makes use of the “_new_scene” function.

https://github.com/EyeBallTank/PROJECT-NORTUBEL-main-ish/blob/main/save_file.gd The recently created “save_file” AutoLoad script.

https://github.com/EyeBallTank/PROJECT-NORTUBEL-main-ish/blob/main/screens/PauseMenu.gd The Pause Menu scene’s script, which has Load and Save buttons.

I even tried to create a new function for “scene manager” that was similar to _change_scene but based on loading a saved scene.

And before i forget:

  • Godot version is 3.5.1

  • PauseMenu (Which has the Load/Save buttons i want to use) is its own scene but also exists as a child node to a scene called “CurrentUI” which can exist as a child scene under levels.

  • Levels are their own scenes with scenes like Player, TileMap, CurrentUI etc as child nodes.

  • Levels also have scripts and their scripts extend to a script called “main_level_script” which has nothing so far.

There’s probably some things i’m overlooking and doing wrong.

Just in case, i’ll leave an imgur album with screenshots: Imgur: The magic of the Internet

Any help is appreciated.