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.

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.