Read and Write data from Resource when EXE is exported

Godot Version

4.2

Question

Hi! So I have a todo list idea, I save data in an Array, each task saved is also an array containg a name, task and color. So an Array within an array and this is saved in a Custom Resource. Everything works great until I export the EXE file, then it would not write the data to the Resource file but only read from it. How could I read and write my Custom Resource or any other suggestions to get my data is welcome. Thank you in advance.

Instead of a resource, here are a some ideas

  1. Use an online database | This would be more difficult and require an online connection
  2. Save the data in the “user://” directory
  3. Use a dictionary and save a json and save in “user://”

The user directory exists on all platforms, windows, macos, ios, android, and linux
a dictionary example could be

var Tasks: Dictionary = {
    "NewTaskName": {
        "Color": "FFFFFFFF",
        "TaskDetails": "Description of task here"},

    "NewTaskName": {
        "Color": "FFFFFFFF",
        "TaskDetails": "Description of task here"},

    "NewTaskName": {
        "Color": "FFFFFFFF",
        "TaskDetails": "Description of task here"}
}

As a dictionary you would be able to get a list of your tasks by name using Tasks.keys() which will return an array of each NewTaskName

1 Like