How to create a UI in Unity!

Display Score System and update the UI with code

Score System

Create an UI Text

UI and different screen sizes

Adjust the Anchor

Adjust UI size based on screen size

Score System

Update the UI from Script

using UnityEngine.UI;
[SerializeField] private Text scoreText;
public void UpdateUI(int scoreUpdate)
{
_score += scoreUpdate;
_scoreText.text = "Score: " + _score;
}

Aspiring developer that’s self-learning Unity & C# to transition to a career with Unity. I got a passion for creating interactive experiences.