0 votes

I have an Item list node that holds my quest and I want to know how I would save the node and all the items it’s currently holding. Thanks to the Godot docs I know how to save variables like my player stats but when it comes to a node like the Item list I can’t turn it to a var to store it. So that’s my question, how to save a node like the item list using something like the save method from the godot docs. Thanks!


asked Mar 22 in Engine by Asthmar (267 points)
edited Mar 22 by Asthmar

1 Answer

0 votes
Best answer

You can try using the inst2dict and dict2inst methods, see here: https://docs.godotengine.org/en/3.1/classes/class_@gdscript.html

If those don't work, your best bet is to manually serialize the properties of the nodes you know you will change, and manually deserialize them. Example:

func serialize():
    return {
        "position" : position

func deserialize(dictionary):
    position = dictionary["position"]
answered Mar 22 by Avantir (95 points)
selected May 1 by Asthmar
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 How to use this Q&A? before posting your first questions.