I implemented the save system for variables and quests for the dialogue system, but when I try to load it I get an error. Have I missudnerstood how to use it? It happens exactly when I do ApplySaveData.
My code:
Code: Select all
public void LoadSaveData() {
saveData = SaveManager.LoadGameData(out bool wasEmpty);
if(!wasEmpty) {
PersistentDataManager.ApplySaveData(saveData.dialogueSystemData);
}
}
public void SaveGameData() {
string s = PersistentDataManager.GetSaveData(); // Dialogue system data
saveData.dialogueSystemData = s;
SaveManager.SaveGameData(saveData);
}
Code: Select all
"Variable={Alert=\"\", GeoTrack=\"W1L1\", [\"function.LocalRNG\"]=0, [\"function.RangeRNG\"]=0, [\"function.Battlewon\"]=false, LimitedChars=true, [\"rundata.HasFoughtRichMerchant\"]=false, charTrack=\"Namechange error\", BTmusclememory=false, BTshrine=true, PlayerGold=0, PlayerHealth=0, PlayerLives=0, BToldman=false, BTFruitRed=false, BTFruitBlue=false, BTFruitYellow=false, BTrecruitNaras=false, BTrecruitDion=false, Locked_=true, PartyNumber=1, Actor=\"\", Conversant=\"\", ActorIndex=\"\", ConversantIndex=\"\"}; Item[\"WarriorLead\"].State=\"active\"; Item[\"DruidLead\"].State=\"unassigned\"; Actor={_PC_Warrior={Name=\"(PC)Warrior\", Pictures=\"[]\", Description=\"\", IsPlayer=true, NodeColor=\"#e2a536ff\", Display_Name=\"Dion\"}, _PC_Druid={Name=\"(PC)Druid\", Pictures=\"[]\", Description=\"\", IsPlayer=false, NodeColor=\"#d36094ff\", Display_Name=\"Naras\"}, Responsive={Name=\"Responsive\", Pictures=\"[]\", Description=\"Placeholder: When a node responsively should decide actor\", IsPlayer=true, NodeColor=\"#d8d7d7ff\", Display_Name=\"Namechange error\"}, [\"\"]={Name=\"\", Pictures=\"[]\", Description=\"The world actor (get info from world)\", IsPlayer=false, Display_Name=\"\", NodeColor=\"#fae1e1ff\"}, SHOP_Nomadic={Name=\"SHOP Nomadic\", Pictures=\"[]\", Description=\"\", IsPlayer=false, NodeColor=\"#77b2b9ff\", Display_Name=\"Nomadic Trader\"}, Old_man={Name=\"Old man\", Pictures=\"[]\", Description=\"Old man character\", IsPlayer=false, NodeColor=\"#77b2b9ff\"}, [\"????\"]={Name=\"????\", Pictures=\"[]\", Description=\"Gives direction in Phase 1.\", IsPlayer=false, NodeColor=\"#2d2d2dff\"}, _PC__Rogue={Name=\"(PC) Rogue\", Pictures=\"[]\", Description=\"As of yet not in use in the game (test)\", IsPlayer=true}, _PC__Sorcerer={Name=\"(PC) Sorcerer\", Pictures=\"[]\", Description=\"As of yet not in use in the game (test)\", IsPlayer=true}, _PC__Cleric={Name=\"(PC) Cleric\", Pictures=\"[]\", Description=\"As of yet not in use in the game (test)\", IsPlayer=true}, Bandit1={Name=\"Bandit1\", Pictures=\"[]\", Description=\"Bandit in bandit-toll\", IsPlayer=false, Display_Name=\"Toll Person.\", NodeColor=\"#77b2b9ff\"}, Robot_Robot_Surgeon={Name=\"Robot Robot Surgeon\", Pictures=\"[]\", Description=\"A rando who upgrades.\", IsPlayer=false, Display_Name=\"Robot Robot Surgeon.\", NodeColor=\"#77b2b9ff\"}, Gambling_host={Name=\"Gambling host\", Pictures=\"[]\", Description=\"The host of the house of wagers. \", IsPlayer=false, Display_Name=\"Hostess\", NodeColor=\"#77b2b9ff\"}, Stranger={Name=\"Stranger\", Pictures=\"[]\", Description=\"With a thing\", IsPlayer=false, NodeColor=\"#77b2b9ff\"}, Error_Actor={Name=\"Error Actor\", Pictures=\"[]\", Description=\"Error expression in character change\", IsPlayer=true, NodeColor=\"#bb8787ff\", Display_Name=\"Ch. Change Error.\"}, Strange_Voice={Name=\"Strange Voice\", Pictures=\"[]\", Description=\"The machine spirit/ Rogue Architecht.\", IsPlayer=false, NodeColor=\"#454545ff\", Display_Name=\"Strange Voice\"}}; StatusTable = \"\"; RelationshipTable = \"\"; "
Code: Select all
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.DialogueSystem.PersistentDataManager.EnsureQuestsExist (System.String saveData) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/PersistentDataManager.cs:351)
PixelCrushers.DialogueSystem.PersistentDataManager.ApplyLuaInternal (System.String saveData, System.Boolean allowExceptions) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/PersistentDataManager.cs:260)
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData (System.String saveData, PixelCrushers.DialogueSystem.DatabaseResetOptions databaseResetOptions) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/PersistentDataManager.cs:246)
PlayerData.LoadSaveData () (at Assets/Scripts/PlayerData.cs:66)