The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

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?

in Engine by (305 points)

Did you save and load game data with json format?

Yes, exactly.

3 Answers

0 votes

try remove a file in ~/.godot if you using linux
your script new have function to create a new savegame file check that before.

i think will work

by (102 points)

Well, Í am on Windows, but unfortunately, that doesn't solve it.
thanks for answering though.

+1 vote

There is a similar issue with parsing json format.
https://github.com/godotengine/godot/pull/5921

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()
by (9,800 points)

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.

0 votes

Alright I solved the issue now, the input function of a different node caused this problem, but it works again.
Thanks to everyone who answered!

by (305 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.