Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Andrea |
Hello, i’m using the code below to load a resource (that i use as save file).
When it find a save file it loads it, when it no, it prints “no save file”
If i launch the project from debug it works correctly, but if i export the project it doesnt: sometimes, even after i delete the savefile from the folder, it loads an “old” file (i dont honestly know where does it load from)
The funny thing is it does not happens all the time: when it does, i have to re-export the project, and then it works correctly till it breaks again.
I’m not sure if this is caused by some bug in my code or some intrisic behaviour of how the resources are stored in memory?
func load_from_file():
var file=File.new()
if file.file_exists("res://Saves/SaveGame.res"):
load_save(load("res://Saves/SaveGame.res"))
else:
print("There is no save file")