How to Keep Score in Unity Using Unity Events and Text Mesh Pro

preview_player
Показать описание
In this Unity tutorial we're going to look at how to allow the Player to gain points by killing enemies, and how to display the score on screen.

We'll cover the creation of scripts to keep track of the score and increase it when enemies are killed. Then we'll display the score using Text Mesh Pro and use Unity events to update the UI whenever the score is changed.

This is the fifteenth video in our series showing how to make a full top down 2D shooter game in Unity.

The playlist for this series can be found here

The project files are available to our patrons here:

Want to follow along? This project is a good starting point

The full Top Down Shooter Project is available to our patrons here

The final script can be found here

Help support our work:

Follow us:

Introduction - 0:00
Creating a Script to Keep Track of the Score - 0:35
Creating a Script to Increase the Score When the Enemy Dies - 2:30
Displaying the Score in the UI Using Text Mesh Pro - 5:24
Summary - 8:44:38

#KetraGames #LearnUnity #UnityTutorials #UnityTips
Рекомендации по теме
Комментарии
Автор

Thanks for your all tutorial it's helped me lot keep it up 😊

divyanshusingh
Автор

This was super helpful! Thank you so much

hefferwolff
Автор

will you continue? im liking this series

loscaballerosdebronzodia
Автор

Hey Ketra love your tutorials. However I'm a bit stuck on this score count. I have no error codes. But my score doesn't increase. I went back through everything and it all looks correct and things assigned to where it should be. But my score doesn't increase. I was wondering if it was linked with enemy damage? I never used your tutorial for that part, as I'm trying to learn without following tutorials to the T. I only started a month ago and can even write a basic movement script. Any help would be appreciated. Keep up the awesome work 👍

gagaelite
Автор

For anyone who is a stickler for detail, like me. You can add a bit of code in the ScoreUI script so that when your numbers reach the thousands and beyond it will add comma's appropriately.

Like so: $"Score: {scoreController.Score:N0}"; That's Score : Capital N Zero
Example: 1000 becomes 1, 000 and becomes 1, 000, 000.
Happy Game making!

Seshua
Автор

Hi, i made a game with collectives like you video with diamonds and the same script, how can i make that with i get 10 diamonds i get to next level 2?

fernandoabalmedina
Автор

I think u uploaded the wrong video file. Or titled it wrong

digitaldreamlands