Can I save a whole Dictionary?

Hello,

Can I save a whole Dictionary in PlayerPrefs? Or do I have to save each variable of my Dictionary individually?

I'm using Dictionaries to save my scores and other stuff, and I wonder if I can just save the whole dictionary or I have to create a function that save each line of the dictionary.

Thank You.

You could use a technique like ArrayPrefs, where everything is concatenated into a string, and the process reversed when loading. It's faster and takes less space than having individual entries.

If you want to treat your playerprefs as any stream, you might want to check out PlayerPrefsStream. You can use your old stream formatting techniques on it.

Old topic, but for reference:
You can convert the dictionary to a string and save it with PlayerPrefs. Then you can take the string and convert it to a dictionary.

See here:

I usually convert Dict object into json and save as string in PlayerPrefs