cgisca / PGSGP

Play Games Services plugin for Godot Game Engine - Android
MIT License
217 stars 61 forks source link

how to check the data on the func _on_game_load_success(data): function is null #28

Closed titangamingglt closed 4 years ago

titangamingglt commented 4 years ago

suppose i dont have any previous file saved and then try to load the file first without saving it first it is just corruption my game file. i have tried to use data!= null but that doesnot work!

cgisca commented 4 years ago

Hi @titangamingglt , to prevent the case you are encountering you could try following (in the success callback of the load game):

func _on_game_load_success(data: String) -> void:
    if data:
        var game_data: Dictionary = parse_json(data)
        print("Do something with the %s"%data)