Posted February 21, 2025 by Corey Strobbe
#high score screen #json
This will be the final update on this exercise!
Version 1.2 of my Brick Breaker exercise takes what I've learned about Data Persistence and reworked it to display a High Scores screen at the end of the game. Instead of showing only the highest score, it now saves a List of player scores and names and displays them in a screen using JSON files and a Vertical Layout Group in Unity.
My process:
I took the code I wrote for the original project and rewrote the code as a class with a List of PlayerScores and saved a string and an int for the player score and name. Then it takes that list and loads it in the UI at the end of the game. It took a lot of research and thanks to a YouTube video from I believe CodeMonkey and a few others, I got it working.
NOTE: As before, while this can be played in a browser and show the high score screen functioning as intended, it will not save between sessions this way. Since the game uses local json files to load between sessions, I've also made a downloadable Windows build to showcase this functionality.