- Home /
I cannot store data into PlayerPrefs after a certain amount of data
I am currently using ArrayPrefs2 and I am saving about 256 times 256 times 6 Vector3 Values. Just to say there was talk about no limitations in PlayerPrefs but I will propably have to say that there is one after a certain point. I will certainly use another approach to store high amounts of data but I just would like to know what you think about it. Did you run into any limits of data storage?
Yup, it's a somwhat unknown problem but the people who used UnitySerializer will probably know about it and had to implement a solution that made US write to a file ins$$anonymous$$d of PP when the data volume became too large.
Tnx for the reply That is what I was thinking as well. The thing would be if there would be any loading time while reading one value out of a large file :) Other than my workplace (where the problem is) I am using .dat files to store data but it is not as flexible if I could say so... I tried reading myself into json(to get key values and all) but I am a bit scared of object orientated storage since it was a linear approach till now.
Answer by Joe-Censored · Mar 23, 2017 at 07:36 PM
On Windows the PlayerPrefs is stored in the registry. Microsoft recommends any data more than about 2 KB be stored in a separate file outside of the registry. That would suggest it isn't designed to dump 256x256x6 vector3's into.
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724881(v=vs.85).aspx
Answer by Commoble · Mar 23, 2017 at 10:19 PM
If you need to save large amounts of data to the hard disk, you shouldn't be using PlayerPrefs (and arguably you shouldn't use PlayerPrefs to save anything aside from, well, player preferences).
There's a few ways to do this. This official unity live training video goes over using one of them, C#'s Binary Formatter.