Creating a points manager script

In this section, we will create and edit a script to manage our points and to display them on our game's HUD. Here are the steps:

  1. In the Hierarchy panel, select the HUD_Canvas | Score_Value
  2. In the Inspector panel, click the Add Component button
  3. Select New Script and name the script PointsManager
  4. In the Project panel, click Favorites | All Scripts
  5. Drag the PointsManager script to the Assets | Custom Scripts folder
  6. Double-click the PointsManager script to open it in an editor
  7. Edit the script so that it matches the following code

The first section of the code contains the namespace import statements and the PointsManager class declaration:

 using System.Collections; using System.Collections.Generic; using

Get Getting Started with Unity 2018 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.