VersionedDataStruct - coldrockgames/gml-raptor GitHub Wiki
It is recommended to use this class as parent for all structs, that will be part of your SaveGame.
Under the hood, this class silently registers a Broadcast receiver, which listens to Raptor-internal broadcasts, namely the Savegame Broadcasts.
When a game is loaded, the broadcast is caught and the Savegame Versioning is triggered. In addition, this class offers an on_game_loaded
callback, which gets invoked, when this struct has been loaded from a savegame, thus offering the same (or similar) functionality as you find in The Saveable Object's User Event 15
. You may react on the loading of a game from within a data struct! That's great, isn't it?
function MyDataClass : VersionedDataStruct {
name = "";
someother_var = "";
on_game_loaded = function() {
// if loaded from a game, this gets called
}
}
This class is also the base class for the Versioned DataBuilders, as describen in DataBuilder.