I think the title pretty much sums it up. How can I speed up PlayerPrefs?
You should NOT use PlayerPrefs to store big amount of data, in fact you shouldn’t use it to store more then just some few variables, at most. I don’t even know how you can even begin to think about using it for so many objects, when you can’t make any code efficient that way as you can not store child nodes through that system.
You should use xml, or at least begin with that until you understand or get someone to help you use other systems as xml is pretty easy but introduces experience that will make more advanced stuff easier to pick up.
I recommend you watch the episode 109 through 114 on this playlist;
C# Beginners Tutorials Playlist
You should only use PlayerPrefs to store things like highscore, and not much more as the system was never made for that.
I’ve replaced Unity’s PlayerPrefs with PreviewLabs’ version in my current project. I’ve tested and benchmarked the performance of both(on a windows PC with an SSD). Unity stores values in the registry. PreviewLabs stores them in the AppData folder.
I’m doing a SetFloat() and GetFloat() on 1000 floats in a loop and deleting each one in another loop. Results:
Unity PlayerPrefs: 0.085s. There is a noticeable hiccup when this happens.
PreviewLabs PlayerPrefs: 0.002s and when Flush() is called after the loops, 0.011s
This proves that the PreviewLabs one is almost 42 times faster in this case. Even when doing a file write with Flush (), it’s 7.7 times faster. If you’re gonna use this, it’s your responsibility to call Flush () at suitable places, otherwise it wont save to disk.
Hope this helps.
I wouldn’t do that.
Although if you wrote to a text file and have them load one by one, that could work no?