Efficient data saving? PlayerPrefs vs. XMLSerialization


I know this subject is highly depending on the individual needs and setups.
But I’m wondering what would be the best way of saving data. I couldn’t find anything really useful yet.

What method is better in performance? (also considering mobile platforms)

I know there may be no general answer to this so I will need to save about 10 to 50 object positions and a few other variables.

Can someone recommend me one of the methods? I’m quiet familiar with XMLSerializing however I didn’t use it in unity and don’t know how performance is and what needs to be considered here, and I’m interested in finding the best possible way :slight_smile:


A - check out Unity Serializer (by Whydoidoit, a top unity dev). it is free and very widely used in almost every project

B - FTR you can’t use PlayerPrefs in the real world because it’s not encrypted or obfuscated. it’s only for demos and learning. you’d have to use Secured PlayerPrefs (works identically) from the asset store, or, write your own

C - note that Eric5h5 has the excellent array prefs system which may make your life easier. Very cleverly, the “Secured PlayerPrefs” guy included an array feature, so if you do use “Secured PlayerPrefs” your job is totally done if you want an array as well

D - 50 items is zero so forget performance aspects. there are absolutely no performance considerations here in any way. (Note that you’d just be keeping your 50 positions in a simple List during play, and from time to time you’d save it. there’s no performance aspect.)