I am attempting to save this dictionary to playerprefs:
var playerScores = new Dictionary.<String, Dictionary.<String,double> >();
I look online but haven’t found a fix to this. the issue is unity’s playerprefs doesn’t save dictionary’s. Does anyone know a workaround or fix to this issue?
AFAIK, besides saving string, integer and float you can’t save anything to
PlayerPref. To resolve this issue, you can use Serialization to convert your object to an string representation and save it to a file.
As an starter have a look at this thread.
Also, once it is converted to a string you can also use
PlayerPrefs.SetString to save it to the PlayerPrefs class but based on your comment here, saving a lot of data to PlayerPrefs can slow down it on devices.
Hope it helps!
What solved for me was that Odin Inspector already serializes dictionaries, and I was already using it.
So I could use JsonUtility on the class that has the dictionary and it just worked.