Least Resource Consuming Method of Saving Values

I need to save values for my game and I want to use the least resource consuming method possible. Would that be using playerprefs or are there other methods?

I use a .bin file. Seems pretty fast if you don’t have that much to save. Of course, you need to use C# scripting.

An example from my game Ardalon:
using System.IO;
public void SaveGameState()
{
using (BinaryWriter MyWriter = new BinaryWriter(File.Open(“Save.bin”, FileMode.Create)))
{
MyWriter.Write(score);
MyWriter.Write(highScore);
MyWriter.Write(level);
MyWriter.Write(wave);
MyWriter.Write(lives);
MyWriter.Write(baseHealth);
MyWriter.Write(maxHealth);
MyWriter.Write(power);
MyWriter.Write(maxPower);
MyWriter.Write((double)powerRegen);
}

UpdateText.text = “Game Saved”;
updateTextTimer = UPDATE_TIMER;
}

Note, I don’t think this will work for WebGL builds and will need some tweaking to work on iOS and Android (to locate a writeable location on the device).

If you can get away with PlayerPrefs I think its a more portable and consistent approach.

After looking over PlayerPrefs more I need to be able to store bools, arrays and lists. Which PlayerPrefs doesn’t support.

http://wiki.unity3d.com/index.php/ArrayPrefs2

–Eric

Thank you Eric.