I'm trying to save my game using .save files. When loading data back in I can't access any of the saved objects' properties or methods. It throws an "Invalid get index "x" on base Reference()
Any advice ?
Code here :
func saveData():
var data = globals.game_data
var dir = Directory.new()
if !dir.dir_exists(SAVE_DIR):
dir.make_dir(SAVE_DIR)
var file = File.new()
var error = file.open(save_path, File.WRITE)
if error == OK:
file.store_var(data, true)
file.close()
func loadData():
var file = File.new()
if file.file_exists(save_path):
var error = file.open(save_path, File.READ)
if error == OK:
globals.game_data = file.get_var(true)
file.close()