Godot Version
4.5
Question
I’ve created a save system for my godot project which involves a SaverLoader node and a SaveManager autoload script. My SaverLoaders have an export variable called save_properties where I specify which of the parent node’s properties to save. The actual saving and loading mechanisms work perfectly, there’s no problem there, I just drop a SaverLoader into a scene and specify the properties I want to save and it works. My issue is with inheritance (I would switch to composition since most of my scenes use inheritance but I’m too deep in the weeds with inheritance for this).
I have a base abstract class for intertactable objects in the world called Interactable. I have also a base Interactable scene that I all my interactables inherit from. I’ve put a SaverLoader in this base scene, and specified the properties specific to the Intertactable base class that I would like saved. Then, for example, I have my interactable door scene, which now has those properties in the list. I now add the door specific props I want to save to the list. That works fine. But, say I now want to add a new prop to the base interactable class to save, that I would obviously want all my inheriting scenes to also save. The newly added prop does not propagate to the inheriting scenes because their save_properties exported value has been modified, and by resetting to default I lose the, for example, door specific properties.
Does anyone have an idea for a solution to this? Data serialization and de-serialization works just fine, and my implementation can handle dynamically created nodes. The issue lies purely in selecting which properties on an object are saved, from an inheritance standpoint.
Any help would be appreciated.