Making game suitable for release

My game is pretty much done but one problem which is to do with the high score. The high score is saved to my one and I don’t know how to reset it to default one of 0 for new people downloading the game.
I have a script which may need to be used to reset it however I’m not sure what to do please help

How are you saving the score? If you are using PlayerPrefs you can check to see if the player has ever set a highscore PlayerPref variable using:

PlayerPrefs.HasKey("High Score")

This will tell you if they have a high score, and if there is no high score you can set the variable to 0:

    if (!PlayerPrefs.HasKey("High Score"))     //If there is no PlayerPref variable called High Score
    {
          PlayerPrefs.SetFloat("High Score", 0);         //Set the high score to 0
    }

If by releasing it you mean making a build so it can be downloaded from an app store the build won’t contain your editor/local device Highscore/s.

Just for future reference though you can delete a PlayerPref using the PlayerPrefs.DeleteKey("Name of Save") method.

Add a way to reset the high score inside your game. That should be easy to program - just look where you set highscores, and copy the code to write 0’s and --'s-. Before making a build for release, run in the Editor and use the reset. Check to be sure it worked. This is a terrible solution, but it’s technically simple. I think I’ve actually put something in the Apple Store with a little progress on some items, since I forgot to reset it.


You can make it secret: comment it out after you use it, or make it be a keypress (which wouldn’t even be in a mobile version).
Whether you need it may depend on how the scores are saved. I use a textfile in the read/write section, and those carry over into builds.