Hello,
I'm getting the following error when I try to run my LoadGalaxy method:
InvalidOperationException: Trying to load data of type Galaxy, but data contained in file is type of System.Collections.Generic.Dictionary`2[UnityEngine.Vector2Int,GalaxyObject].
My Galaxy class contains a dictionary, but it also contains other member variables, so I am not sure why I am getting this error. Can dictionaries not be saved if they are part of a custom class?
Thanks!
InvalidOperationException problem...
Re: InvalidOperationException problem...
Hi there,
I would first try deleting your existing save data by going to Tools > Easy Save 3 > Clear Persistent Data Path in case you've previously saved a Dictionary to the same key.
Also if you've previously created any ES3Types from the Types window, I recommend deleting these and regenerating them. You can delete them from Assets/Easy Save 3/Types/.
If this doesn't resolve the issue please could you show me the scripts you're using to save and load, and also your Galaxy class.
All the best,
Joel
I would first try deleting your existing save data by going to Tools > Easy Save 3 > Clear Persistent Data Path in case you've previously saved a Dictionary to the same key.
Also if you've previously created any ES3Types from the Types window, I recommend deleting these and regenerating them. You can delete them from Assets/Easy Save 3/Types/.
If this doesn't resolve the issue please could you show me the scripts you're using to save and load, and also your Galaxy class.
All the best,
Joel
Re: InvalidOperationException problem...
Thanks! I will give that a try and get back to you.
Re: InvalidOperationException problem...
Hello again,
I figured it out! First off I was saving the dictionary and not the field. After I fixed that I found out I needed a parameter free constructor before ES3 could handle loading and saving it. I fixed that and created a type and now it works perfectly (so far).
Thanks!
I figured it out! First off I was saving the dictionary and not the field. After I fixed that I found out I needed a parameter free constructor before ES3 could handle loading and saving it. I fixed that and created a type and now it works perfectly (so far).
Thanks!
Re: InvalidOperationException problem...
Hi there,
If it's saying that you need a parameterless constructor then you're on an older version of Easy Save, so I recommend updating also.
All the best,
Joel
If it's saying that you need a parameterless constructor then you're on an older version of Easy Save, so I recommend updating also.
All the best,
Joel