Chapter 13. Collectables — What Next?

Great progress so far! You are able to create and control a good-looking and functional UI. Let's move on. In this chapter, we will cover the following topics:

  • Introducting collectables
  • Preparing collectable prefabs
  • The score and high score
  • Persisting data using player prefs
  • What's next? Your path to greatness

Collectables

All objects in a game that the player is able to collect are called collectables. Probably, you are a gamer yourself and this concept should be fairly familiar to you. In our game, we will add collectable coins scattered in the level's pieces for the player to collect. I am not going to talk too much about what collectables are and why it is good to use them as I believe it is pretty obvious. Let's skip all that and make a simple plan:

  • Our collectables—let's call them coins from now on—will be collected on contact with the player game object
  • We will write the Collectable class to manage coin behavior
  • For every coin collected, we will count and increment the number of collected coins on the UI
  • The count of total collected coins will restart with the new game
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset