Week 6 | Session 2 - Keeping Score - April 28, 2020
Tutorial
·
Beginner
·
+10XP
·
60 mins
·
(28)
Unity Technologies

Objects fly into the scene and the player can click to destroy them, but nothing happens. In this lesson, we will display a score in the user interface that tracks and displays the player’s points. We will give each target object a different point value, adding or subtracting points on click. Lastly, we will add cool explosions when each target is destroyed.
Languages available:
1. Overview
This is the same content covered in Lesson 5.2 in the independent Create with Code Course.
What you will make:
- A “Score: “ section will display in the UI, starting at zero. When the player clicks a target, the score will update and particles will explode as the target is destroyed. Each “Good” target adds a different point value to the score, while the “Bad” target subtracts from the score.
What you will learn:
- Create UI Elements in the Canvas
- Lock elements and objects into place with Anchors
- Use variables and script communication to update elements in the UI
2. Before you Begin
To participate in this session and follow along, you need:
- Unity 2018.4 installed
- An up-to-date project open in Unity:
- If you have followed along with us this week and have your own project ready, you are good to go!
- You can also download the instructor's up-to-date project and import it (If you don't know how to import a project, you can read how here)
If this is your first Create with Code live learning session, you can catch up by:
- Following along with the recordings of our previous live learning sessions
- Completing the same lessons in the independent Create with Code Course
*Note - it is not necessary for you to catch up, but it is recommended for an ideal learning experience.
3. Recorded Live Session - 28th April - 9am PST
If you missed this session, you can catch up with the video below.
4. Recorded Live Session - 28th April - 5pm PST
If you missed this session, you can catch up with the video below.
5. Next Steps
Get caught up:
If you were not able to finish the session along with the instructors, you can catch up by:
- Re-watching this recorded session when it is posted in Step 3 above at 3am PT (10am UCT) the morning after this session's date
- Picking up where you left off in Lesson 5.2 of the independent Create with Code Course
Bonus Challenges:
- Experiment with new features (after making a backup)
- Create a "Lives" UI element that counts down by 1 when an object leaves the bottom of the screen
- Add background music and sound effects when an object is clicked
- [Difficult] Create an effect where the score quickly counts up to its new value rather than just appearing as the new value
- Look ahead to the next lesson
- If you want to go ahead and preview what we'll be covering in the next session, you can give it a try in Lesson 5.3 of the independent Create with Code Course.