EasySav3 TypeLoadException

Discussion and help for Easy Save 3
Post Reply
Kosta
Posts: 6
Joined: Wed Jan 01, 2020 3:58 pm

EasySav3 TypeLoadException

Post by Kosta »

I want to save player inventory but the problem is I get error:
TypeLoadException: ES3Type for primitive could not be found, but the type list has been initialised and is not empty. Please contact Easy Save developers on mail@moodkie.com
Image
Inventory.cs

Code: Select all

public List<ItemLib> itemLibs = new List<ItemLib>();

private void SaveInventory()
{
	ES3.Save<List<ItemLib>>(saveKey, itemLibs);
}
ItemLib.cs

Code: Select all

[System.Serializable]
    public class ItemLib : IComparable<ItemLib>
    {
        public Item item;
        public GameObject obj;

        public ItemLib(Item _item, GameObject _obj)
        {
            item = _item;
            obj = _obj;
        }

        public ItemLib()
        {
            item = null;
            obj = null;
        }
        
        public int CompareTo(ItemLib other)
        {
            if(other == null)
            {
                return 1;
            }
            
            return 0;
        }
    }
Image
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: EasySav3 TypeLoadException

Post by Joel »

Hi there,

Please could you private message me a basic project which replicates this? I've not seen this error before.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Kosta
Posts: 6
Joined: Wed Jan 01, 2020 3:58 pm

Re: EasySav3 TypeLoadException

Post by Kosta »

Hi Joel,

I created a simple scene with the same inventory scripts and it working...there are no errors...
I wondered if the problem might be that I made an assembly definition (and namespace) for all inventory scripts.
I noticed the easy save don't have an assembly definition file and I created one.
Image
Image
link post facebook image size

did I do something wrong ?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: EasySav3 TypeLoadException

Post by Joel »

Hi there,

To reference something from an Assembly Definition File you need to create an Assembly Definition Reference. As this is more of a question of how Unity's Assembly Definition Files work rather than an Easy Save question, I recommend asking them regarding this as they will be able to provide you with more detailed information.

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