Scoreboard UI
- Create a scoreboard canvas. This can be a background image with a text field on top.
- Add the "ScoreBoard.cs" script from the download link above to a empty gameobject (like a GameManager).
- Drag the canvas into the canvas field and the text element into the "killCounterText" field.
- Add the following code to the script where the character takes damage (to add damage points) or dies (to add kills). This also works when picking up coins, etc.:
Scoreboard.instance.AddKill();
Scoreboard
is the script that manages the UI, and AddKill()
is the function that increments the kill counter.