I made a save and load system and I'm sure that save works fine because I made two buttons, one changes variables other one save files. I used a hex editor and the value was equal to variable so it works. But problem is with loading. I have an button that calls LoadData() function (shown bellow)
func LoadData():
var SFile = File.new()
if SFile.file_exists(SavePath):
var SError = SFile.open(SavePath, File.READ)
if SError == OK:
var GameData = SFile.get_var()
SFile.close()
print(GameData)
After pressing load value should show in a label. Bellow is a dictionary:
var GameData = {
"Level" : Variables.Level,
}
(I use global variables)
Here is label code:
func _process(_delta):
$LevelStarDisplay.text = str(Variables.Level)
And as I said after loading this "Level" variable should be shown in this label but it's not. Default value is 0 and it's showing 0 after running again and pressing load button even though hex editor shows right value. I also tried using "print()" to check if LoadData() function reads it right and it does because it printed out everything right. print(GameData)
If needed I can show more code.
Any help will be appreciated. Thanks.