Last active
May 6, 2021 19:56
-
-
Save henriiquecampos/8d98f0660da499967d41c32988cd3612 to your computer and use it in GitHub Desktop.
A very, versy simple way to save and load games in Godot Engine
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node | |
func save_game(): | |
var scene = PackedScene.new() | |
scene.pack(self) | |
ResourceSaver.save("user://save_01.tscn", scene) | |
func load_game(): | |
var scene = load("user://save_01.tscn") | |
get_tree().change_scene_to(scene) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't want to put this on every node. Instead, you can turn it into a reusable node that you put around the root of your main game scene: