Added the SettingsModHelper. It's a script with 2 very useful SettingsMod tweaks. It was more functions but it's been optimized for uploading
First,
public static void SetSetting<T, TSettingsMod>(string name, T value, WorldSettings worldSettings) where TSettingsMod : SettingsMod, new()
This function sets and saves a setting of type T for the SettingsMod TSettingsMod.
It saves via Unity PlayerPrefs. I'd prefer a different way but this works just fine for now.
I will be making a function that runs after all mods have loaded which cleans out the player prefs of mods which are no longer installed.
Second,
public static T GetSetting<T, TSettingsMod>(string name, T defaultValue)
This function gets a setting of type T for the SettingsMod TSettingsMod
It attempts to load it from the PlayerPrefs. If it fails to load or can't find a setting of the key name at all, it creates a PlayerPref with the key of the name parameter returns the defaultValue parameter.
Added the SettingsModHelper. It's a script with 2 very useful SettingsMod tweaks. It was more functions but it's been optimized for uploading
First, public static void SetSetting<T, TSettingsMod>(string name, T value, WorldSettings worldSettings) where TSettingsMod : SettingsMod, new() This function sets and saves a setting of type T for the SettingsMod TSettingsMod. It saves via Unity PlayerPrefs. I'd prefer a different way but this works just fine for now. I will be making a function that runs after all mods have loaded which cleans out the player prefs of mods which are no longer installed.
Second, public static T GetSetting<T, TSettingsMod>(string name, T defaultValue) This function gets a setting of type T for the SettingsMod TSettingsMod It attempts to load it from the PlayerPrefs. If it fails to load or can't find a setting of the key name at all, it creates a PlayerPref with the key of the name parameter returns the defaultValue parameter.