Topic was automatically imported from the old Question2Answer platform.
Asked By
BE-Never Games
Old Version
Published before Godot 3 was released.
Hey Godoters,
so basically, i have a little bit of a problem and i wanted to ask here, if anyone else encounters this before i open an issue on Github.
For some reason, when i load my game, it crashes the game, there are no error messages and i have no idea why this happens, especially because it worked before and it just suddenly started to happen, when i load my game. i followed the official documentation for loading and saving my game.
Does anyone else here has this problem?
There is a similar issue with parsing json format.
I suggest you to use store_var and get_var for saving and loading with binary format which is much simpler and I believe it faster, if you don’t have any particular reason to use json format.
var data = {"key1":123, "key2":"abc"}
var DATA_PATH = "user://save.data"
func save_data():
var f = File.new()
f.open(DATA_PATH, File.WRITE)
f.store_var(data)
f.close()
func load_data():
var f = File.new()
if f.file_exists(DATA_PATH):
f.open(DATA_PATH, File.READ)
data = f.get_var()
f.close()
Great idea, but unfortunately, that still doesn’t solve it. I am beginning to think, that it doesn’t have anything to do with the loading itself, but instead another script isn’t happy with loading the game. It could also be a bug inside Godot, but I am not so sure about that. It is just weird that this occurs, since it worked fine before.
But anyway, thanks for the answer, i will play around a bit and see if I can finde the problem.