Error when using Snapshots code on Godot 4.x.x
YO-SC opened this issue · 3 comments
Hello there, I am having issues with some of the code in Godot 4. This has to do with Save Games. Sadly I don't really understand the issue or what is going on, but I will provide context and hopefully, it can be solved.
I am receiving the following error:
USER ERROR: Error calling from signal '_on_game_load_fail' to callable: 'Node2D(main.gd)::_on_game_load_fail': Method expected 1 arguments, but called with 0.
This occurs for _on_game_saved_fail
too
For context, I am making the following connections as such (for Godot 4 compatibility)
# Saved games (cloud saves)
play_games_services.connect("_on_create_new_snapshot", Callable(self, "_on_create_new_snapshot"))
play_games_services.connect("_on_game_saved_success", Callable(self, "_on_game_saved_success"))
play_games_services.connect("_on_game_saved_fail", Callable(self, "_on_game_saved_fail"))
play_games_services.connect("_on_game_load_success", Callable(self, "_on_game_load_success"))
play_games_services.connect("_on_game_load_fail", Callable(self, "_on_game_load_fail"))
On the JSON side of things, I am using the methods directly from the JSON
object. Specifically, the stringify()
and parse_string()
. Example:
from var available_events = parse_json(events_array)
to var available_events = JSON.parse_string(events_array)
and
from play_games_services.saveSnapshot("SNAPSHOT_NAME", to_json(data_to_save), "DESCRIPTION")
to play_games_services.saveSnapshot("SNAPSHOT_NAME", JSON.stringify(game_save_data), "This is a test")
The other code works using this implementation, it is just the snapshots part that is causing issues. Furthermore, if I try to show, save, or load snapshots only then do the other parts of the code present the same error message for their respective signals for some reason.
Hopefully we can find solutions to this, I will update this thread if I find one.
also, thanks a lot for this plugin, its really useful 💪
The problem fixed itself (?). I am investigating. The difference was that I ran the game through Google Play Games app. Maybe it has something to do with that?
Hey i know this is old but I have updated the repo for Godot 4
https://github.com/finepointcgi/PGSGP/tree/4.1