Code: Select all
public void RestoreSaveData(object saveData)
{
var myModSaveData = (MyModSaveData)saveData;
text = myModSaveData.Text;
}
Code: Select all
public void RestoreSaveData(object saveData)
{
var myModSaveData = (MyModSaveData)saveData;
text = myModSaveData.Text;
}
l3lessed wrote: ↑Tue Dec 24, 2019 8:33 am And first release of the mod is finished.
Things other's who stumble on this thread should know.
1. To ensure your data restores correctly, do not initiate the save interface anytime after StateTypes.Game. If you do this, your data won't restore on first load, as the vars have not been assigned to memory yet to store them on load.
2. To ensure items are restored correctly, you will always have to refer to their UID's. These are store in ULONG Vars, and can be grabbed individually or in an array through the SerializedEquipTable method.
I wasted the last 4 days tracking down 2 of the simplest bugs in the whole process. I was merely using the wrong item UID referencing with using equip tables, and I wasn't restoring data correctly because I had the wrong StateType initiation for the mod. Learned some lessons the hard way .
This will make future mod development much easier though, now I have a better grasp on how OOP language is used in unity and in DFU.
I'll drop Outfit Manager Beta on nexus and in the forum tonight.
Code: Select all
[Invoke(StateManager.StateTypes.Start, 0)]
public static void Init(InitParams initParams)
{
GameObject go = new GameObject("ClimateCloaks");
instance = go.AddComponent<ClimateCloaks>();
mod = initParams.Mod;
mod.SaveDataInterface = instance;
mod.LoadSettingsCallback = (settings, _) => settings.Deserialize("Options", ref instance);
mod.LoadSettings();
EntityEffectBroker.OnNewMagicRound += TemperatureEffects_OnNewMagicRound;
}