Some Classes dont save while others do

Discussion and help for Easy Save 3
Post Reply
Renoki
Posts: 10
Joined: Thu Jul 19, 2018 12:36 pm

Some Classes dont save while others do

Post by Renoki »

Hi there, Im currently saving and loading a few classes. While some save, others dont and im not sure why. Im hoping I just missed a step.

SAVING:

Code: Select all

		ES3.Save("MainCharacter", SaveFile.Instance.mainCharacter, saveFileName, settings);
		ES3.Save("Inventory", SaveFile.Instance.inventory, saveFileName, settings);
		ES3.Save("CharacterRoster", SaveFile.Instance.characterRoster, saveFileName, settings);
		ES3.Save("PartyLoadouts", SaveFile.Instance.partyLoadouts, saveFileName, settings);
		ES3.Save("DungeonMasteryLevels", SaveFile.Instance.dungeonMasteryLevels, saveFileName, settings);
		ES3.Save("DungeonMasteryExps", SaveFile.Instance.dungeonMasteryExps, saveFileName, settings);
		ES3.Save("QuestProgress", SaveFile.Instance.questProgress, saveFileName, settings);
		ES3.Save("QuestsAccepted", SaveFile.Instance.questsAccepted, saveFileName, settings);
		ES3.Save("QuestsCompleted", SaveFile.Instance.questsCompleted, saveFileName, settings);
LOADING:

Code: Select all

		SaveFile.Instance.mainCharacter = ES3.Load<Character>("MainCharacter", saveFileName, SaveFile.Instance.mainCharacter);
		SaveFile.Instance.inventory = ES3.Load<Inventory>("Inventory", saveFileName, SaveFile.Instance.inventory);
		SaveFile.Instance.characterRoster = ES3.Load<List<Character>>("CharacterRoster", saveFileName, SaveFile.Instance.characterRoster);
		SaveFile.Instance.partyLoadouts = ES3.Load<List<PartyLoadout>>("PartyLoadouts", saveFileName, SaveFile.Instance.partyLoadouts);
		SaveFile.Instance.dungeonMasteryLevels = ES3.Load<Dictionary<string, int>>("DungeonMasteryLevels", saveFileName, SaveFile.Instance.dungeonMasteryLevels);
		SaveFile.Instance.dungeonMasteryExps = ES3.Load<Dictionary<string, int>>("DungeonMasteryExps", saveFileName, SaveFile.Instance.dungeonMasteryExps);
		SaveFile.Instance.questProgress = ES3.Load<Dictionary<string, int>>("QuestProgress", saveFileName, SaveFile.Instance.questProgress);
		SaveFile.Instance.questsAccepted = ES3.Load<Dictionary<string, QuestInfo>>("QuestsAccepted", saveFileName, SaveFile.Instance.questsAccepted);
		SaveFile.Instance.questsCompleted = ES3.Load<Dictionary<string, QuestInfo>>("QuestsCompleted", saveFileName, SaveFile.Instance.questsCompleted);

Code: Select all

public List<ItemObject> itemInventory;

So everything seems to load fine except the items in the Inventory and the Character's equipment, specifically ItemObject and EquipItemObject classes, they always appear as null after loading and viewing the inventory. I even set up their types in the Types settings, just not sure why ItemObjects are always null in an inventory.

EDIT: after debugging, the inventory's itemInventory list keeps the Count just not the data. not sure whats up.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Some Classes dont save while others do

Post by Joel »

Hi there,

Are you getting any warnings in console?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Renoki
Posts: 10
Joined: Thu Jul 19, 2018 12:36 pm

Re: Some Classes dont save while others do

Post by Renoki »

Joel wrote: Sat Feb 10, 2024 3:05 pm Hi there,

Are you getting any warnings in console?

All the best,
Joel
Only about using New() but thats not related to the inventory or saving, entirely other script. Im hoping that doesnt effect it.

Code: Select all

You are trying to create a MonoBehaviour using the 'new' keyword.  This is not allowed.  MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
Also I tried saving the ItemObject list directly but they still come up as null in the list.

EDIT: FYI: EquipItemObject is a child class of ItemObject, could that be why?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: Some Classes dont save while others do

Post by Joel »

Are you using the latest version of Easy Save?

If so, please could you replicate your issue in a new project with a very simple scene and send me a link to it on moodkie.com/contact along with step-by-step instructions and your order/invoice number.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply