In other words, how can I load the progress for a game? I only want to store a score and load it again when the game starts (ex. if I get the 100 score and close the game, when I come back, I want to continue my progress from the 100 score)


You're looking for PlayerPrefs. Take a gander at the documentation.

| improve this answer | |
  • 1
    \$\begingroup\$ The usual caution here is that PlayerPrefs is trivial for users to edit, so make sure you don't trust the data found in this file for things like public leaderboards or awarding trophies / DLC / other entitlements. If your case is pure single-player it may not be important, but it can be demoralizing for players who worked hard for those perks to see peers get them through simple hacking. (It's arguably impossible to completely secure a web game, but you do have choices for how many speed bumps you want to put in a hacker's way) \$\endgroup\$ – DMGregory Jan 29 '16 at 20:59
  • \$\begingroup\$ Thanks for that @DMGregory . Yes PlayerPrefs is for anything you don't care if the player goes and changes it however they please. Local highscore display? Psh, if they want to hack that no one cares. For more complex save stuff, you still have to assume that the player will find a way to rewrite the file. \$\endgroup\$ – Draco18s no longer trusts SE Jan 29 '16 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.