I made a saving system that saves the variables in a file created so that when the game runs again, it returns with the saved data... it works when I run it in the godot editor but, for some reason, it doesn't work when I I export the game and run it... it simply doesn't save the data... here is the code:
Code: Select all
extends Node
onready var player = get_node("/root/test
/player")
const Save_file = "res://assets/save_file.save"
var game_data = {}
func _ready():
load_data()
func save_data():
var file = File.new()
if player == null:
game_data = {
#var
}
else:
game_data = {
#var
}
file.open(Save_file, File.WRITE)
file.store_var(game_data)
file.close()
func load_data():
var file = File.new()
if not file.file_exists(Save_file):
if player == null:
game_data = {
#var
}
else:
Global.save_existe = true
game_data = {
#var
}
save_data()
file.open(Save_file, File.READ)
game_data = file.get_var()
file.close()
#var
if player != null:
#var