problem incrementing player prefs

in my game i want the player taking screenshots of the game. Am using playerprefs to save number of screenshots so i can have screen-1,screen-2 screen-3 etc the problem is it does not increment above 1 and i don’t know why here is my code

function Awake() {

function Encode{
Application.CaptureScreenshot( System.IO.Path.Combine(
        System.Environment.GetFolderPath( System.Environment.SpecialFolder.MyPictures ),
            "screen-" + PlayerPrefs.GetInt("HighScore") + ".png") );
yield WaitForSeconds(2);
PlayerPrefs.SetInt("HighScore",(PlayerPrefs.GetInt("Highscore")+1 ));

thanks for any help

You are using “HighScore” and “Highscore”. This is most likely the cause of your problem.

  • PlayerPrefs.SetInt("HighScore", ...)
  • PlayerPrefs.GetInt("Highscore")

See the error? The keys are not the same. One has a capital S, one does not.