+1 vote

I am making a game in which there are items, and in order to make it simpler to develop I made a plugin for creating items, in which you give it a name, description, and image, and then assign it an ID, which you can pass to different objects in the world as a reference to an object with that name, description, and image (I have an item.gd script so I can have things like var item = preload("res://item.gd").new(image, title, description))

My current approach is basically creating a dictionary containing the IDs as keys for the actual item reference, the problem of course is that I want it to be permanent even when you close the editor or game. How can I do that? (Hopefully I don't need to save the items as files for later access).

Thanks in advance.

in Engine by (131 points)

1 Answer

+3 votes

When you close the game, it leaves the computer's memory. If you need data to persist after quitting the game, you must save the data to a file, then read that data when the game is next run.

See http://docs.godotengine.org/en/latest/tutorials/io/saving_games.html for information.

by (21,979 points)
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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.