using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; public class ScoreManager : MonoBehaviour { public int score; public TextMeshProUGUI scoreText; void Start() { UpdateScoreText(); } public void IncreaseScore(int amount) { score += amount; UpdateScoreText(); } void UpdateScoreText() { scoreText.text = "Score: " + score; } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter