O'Reilly logo

Unity Game Development Scripting by Kyle D'Aoust

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Keeping Score

In many games, having stats and scores are a way of showing the players how far along they've come. For some games, stats decide whether players win or lose the game or rounds they play. There are some games where stats create competition such as a high score table in a racing game, or a ranking system in a first-person shooter game. Stats can be used in many ways. They can influence a player to do things they normally wouldn't do, just to get that stat.

In this chapter, we will:

  • Create stats for the player
  • Implement those stats in our scripts
  • Create a stat tracker for the stats
  • Create an achievement system
  • Use PlayerPrefs to save our stats
  • Use GUI methods to show the stats and achievements
  • Create/assign the stats

Before we implement ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required