Closed Falki-git closed 1 year ago
Would it be possible to change the API to instead be a generic T RegisterSaveLoadGameData<T>(string key, Action<...> onSave, Action<...> onLoad, T defaultValue = null)
where it returns a default constructed object (Via Activator.CreateInstance(typeof(T))
), or the default value if one was passed, that represents the saved data
Like so?
Yep, exactly like so
This adds 3 API methods for mods to:
Usage is:
MySaveDataObject can be any kind of object.
I'll keep this as a draft for a while to get comments and so I could test it in real scenarios more thoroughly.