Hi
I am very close to releasing my first iPod Touch game, however I am struggling to understand how I can initialise my PlayerPrefs.
I am using PlayerPrefs to
- save my game and allow the player to continue after an interruption or after returning to the home screen
- save medal stats/scores
I have a single playerpref which is used as a flag: ‘IntialisePrefsOK’. When this is set to 0 (zero) then a function is called which resets all the medals to zero etc. This should only happen once, the very first time the game is launched on a machine. However I cannot understand how I should create the flag in the first place. Would the following code work if the game is played for the very first time on a machine: -
if (!PlayerPrefs.GetInt("init_prefs_ok")){
PlayerPrefs.SetInt("init_prefs_ok", 0);
}
Thanks for your help