Hi!
function Awake()
{
if(!PlayerPrefs.HasKey("gameLaunchCount"))
{
PlayerPrefs.SetInt("gameLaunchCount",1);
}
else
{
PlayerPrefs.SetInt("gameLaunchCount",PlayerPrefs.GetInt("gameLauchCount")+1);
}
PlayerPrefs.Save();
print(PlayerPrefs.GetInt("gameLauchCount"));
}
Always prints 0
Why isnt this one working? I cant figure out…
Thanks in advance!
That's why you should use string constants static var gameLaunchCount = "gameLaunchCount"; [...] PlayerPrefs.GetInt(gameLaunchCount);
– Bunny83