Godot Version
4.4
Question
This is a bit of a clumsy phrasing for the question, but here’s what I’m after…
I’m trying to figure out the best way to handle custom resources which are both referenced by the save data, used by in game objects and referenced by certain ui elements. The data in these resources is totally static, but other objects and scripts need to know about them in various places in order to process and display data and textures.
I have a common id for each item which acts as a reference to both a particular element in the save data as well as the corresponding resource, but I’m not sure if this is really ideal? Basically the key value in the save data is the same as an ID variable on the resource and that’s how I tell how they connect. I could store the resource as an element in a sub-dictionary, but I don’t want to save it along with the other information.
So what’s a good general practice for how to handle this? Should I have an autoload that contains all of the resources as constants? Should I make them all custom classes? This latter option seems impractical beyond a certain number of items.
I’ve searched for a good while, but I may not know enough to know what I’m missing, so I may not be asking the question in the best way. Any insight on this would be much appreciated.