Here is a class called Storage that allows loading and saving json files, text-plain and data.
But you can add the StorageManager in your scene to access to that class. You can turn TRUE the "blocker" property in this Node to specify that in case of error a message should be displayed and the game ended.
var storage : Storage = Storage.new("user://settings.data", "ENCRYPT_PASSWORD")
var data = storage.load_data()
if data.result == OK:
AudioServer.set_bus_volume_db(0, linear2db(data.data.volume))
OS.vsync_enabled = data.data.vsync
else:
AudioServer.set_bus_volume_db(0, linear2db(.8))
OS.vsync_enabled = true
var storage : Storage = Storage.new("user://settings.data", "ENCRYPT_PASSWORD")
var result = storage.store_data({ "xxx": "yyy" })
if result != OK: print("Error")
var storage : Storage = Storage.new("res://file.json")
var data = storage.load_json()
if data.result == OK:
print(data)
else:
print("ERROR")
var storage : Storage = Storage.new("user://settings.data")
var result = storage.store_json({ "xxx": "yyy" })
if result != OK: print("Error")
If you are felling it, please leave a donation!