#14 | 31-07-24 | High Score


Hello!

Today's task is to build the saving high score feature. This'll allow the highest score of any game played to be saved and displayed on the main menu.

To create the saving system, I used PlayerPrefs, which is a simple built-in way to save data in Unity. I modified the TimeCounter script to save the score after the counter reaches zero.

I created a script called "LoadScore" to handle loading and displaying the current highest score on the main menu. The script is attached to a game object called "Menu Manager" which will hold other scripts that need to be run while the scene is active.

Loading and display the score was simple enough. I used a local float and a logic check to set the highest score and displayed it using TextMesh Pro. I also created a function to handle resetting the current highest score by pressing the "R" key.

Here's a video to demonstrate the code in use:

That's another feature finished. Next up will be creating a combos mechanic, multiple different targets and revamping the shooting system.

Thanks for reading!

Get Hit That Target!

Leave a comment

Log in with itch.io to leave a comment.