- Home /
ES2 Can't save Dictionary
Hello!
I'm not 100% sure if I should post here about this. Please tell me if that's the case.
I have a problem with the Easy Save asset from the asset store. It says in the documentation that Dictionary is a supported type, but when I try to save a dictionary, it gives me an error.
This is my code:
ES2.Save(unlockedBackgrounds, "save.txt?tag=unlockedBackgrounds&encrypt=true");
Where unlockedBackgrounds is a Dictionary with both key and value of type String. I get this error:
Easy Save does not support saving of type System.Collections.Generic.Dictionary`2[System.String,System.String].
What should I do to fix this? I read that you can manually add types, but I shouldn't have to do that since Dictionaries should be supported. Does anyone know?
Thanks. /Alex
have you contacted the creator of that asset? they're most likely the best place for help.
Answer by alexanderflink · Dec 30, 2015 at 11:33 PM
I got a great answer from the creator of the asset. If anyone else has this problem, it turns out you need to explicitly state what type you are saving if you are using unityscript.
So, do this instead:
ES2.Save.<String, String>(unlockedBackgrounds, "save.txt?tag=unlockedBackgrounds&encrypt=true");