- Home /
How many variables can I store using PlayerPrefs
Using the web player with a 1mb cap, how much data would be a reasonable estimate. Say would around 5 ints and 5 floats be acceptable? I would think so, I just want to be sure.
Answer by Bunny83 · Aug 02, 2011 at 11:38 PM
The size of an int and also of a float is 4 bytes. But the playerprefs have some overhead of course. The name of your "variable" is also stored as well as what type the stored value have.
If you use this line:
PlayerPrefs.SetInt("VariableName",123456);
it will need
- 1 byte that indicated the length of the name
- 12 bytes for the name ("VariableName")
- 1 byte for the type
- 4 bytes for the actual data
= 18 bytes
If you only store ints and floats and your variable names are always ~12 characters, you can store ~58250 different values before you reach the 1MB cap.
Well, that was helpful. I don't think it will be a problem ;D
Your answer
Follow this Question
Related Questions
PlayerPrefs reset error 0 Answers
Help with Saving ArrayPrefs 0 Answers
PlayerPrefs not saving my variable value for HighScore System 3 Answers
Highscoring and changing scripts (Java/UnityScript) 1 Answer
Unity webplayer crashing browser when it is loaded and unloaded into a page using JavaScript 0 Answers