Saving Dictionary of a Class not working

Discussion and help for Easy Save 3
Post Reply
Berncat
Posts: 5
Joined: Tue May 26, 2020 12:28 am

Saving Dictionary of a Class not working

Post by Berncat »

I have a GameManager class that holds a dictionary of a class TileManager. I have made an ES3Type for TileManager as well as GameManager. When saving GameManager and loading it via loadinto, it works fine with normal types, but when I try to access the dictionary TileManagerDict it returns true on TileManagerDict.Containskey(SceneName), but when accessing that TileManagerClass it throws a null exception error.

I know that the way I am accessing the data isn't an issue because I'm able to access the dictionary during runtime, its only after saving and loading that it returns null exception error.

I made a type TileManagerArray as well but that didn't work either.

Any ideas?

User avatar
Joel
Moodkie Staff
Posts: 2971
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving Dictionary of a Class not working

Post by Joel »

Hi there,

It's not possible for me to tell what is happening from what you've described. Please could you create a basic script which I can drop into a new scene which demonstrates your issue?

All the best,
Joel
Joel @ Moodkie Interactive
Twitter - Unity

Berncat
Posts: 5
Joined: Tue May 26, 2020 12:28 am

Re: Saving Dictionary of a Class not working

Post by Berncat »

When I reduced what was saved to exclusively the two dictionaries it did as expected fortunately. Seems I was attempting to save a static reference to an instance which may have been causing an issue to make the entire class save null.

All good, ty for quick reply.

Post Reply