Page 1 of 1

Saving Dictionary of a Class not working

Posted: Tue Aug 25, 2020 3:34 am
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?

Re: Saving Dictionary of a Class not working

Posted: Tue Aug 25, 2020 8:05 am
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

Re: Saving Dictionary of a Class not working

Posted: Tue Aug 25, 2020 9:03 am
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.