Unity Learn home
0
1
Sprite Flight via Unity Tutorial
254 views
My version of Unity Tutorial game Sprite Flight. The tutorial was mostly easy to follow however there were few times where I hoped for better and more detailed explanation of how to do certain things. For example, I wished there were more detailed hints on how to do those optional steps. More specifically the HighScore part, I couldn't for the life of me find any tutorial that used the UIToolkit. If anyone knows how to do it please do tell.
Media
1
1
R
Roger013
6 months ago
Just add another label to the UI layout, similar to the one used during the tutorial. Adjust the top offset of both labels so that the old one is positioned below the new. And in the code, write something like private void UpdateHighScore() { if (score > highScore) { highScore = score; PlayerPrefs.SetFloat("HighScore",highScore); highScoreText.style.borderBottomColor = new(new Color(0, 255, 0)); highScoreText.style.borderLeftColor = new(new Color(0, 255, 0)); highScoreText.style.borderRightColor = new(new Color(0, 255, 0)); highScoreText.style.borderTopColor = new(new Color(0, 255, 0)); } highScoreText.text = "High score: " + highScore; } (I didn’t figure out how to make UI toolkit animation myself, so I had to settle for turning it green when breaking a record)