---
title: 02 UI Setup
description: "Setting up the game’s UI. In this tutorial we’ll set up the HUD to display the player's score and the number of turns. If you remember, we've already set the Makinom project's UI system to use the Unity UI module,…"
url: "https://makinom.com/guide/tutorials/match-3/02-ui-setup/"
updated: "2021-01-04"
category: Match 3
---

# 02 UI Setup

Setting up the game’s UI.

In this tutorial we’ll set up the HUD to display the player's score and the number of turns.

If you remember, we've already set the Makinom project's UI system to use the Unity UI module, i.e. we'll do most of the setup in the scene, using components and the Unity UI. You can learn more about UI systems in general in [this documentation](https://makinom.com/guide/documentation/ui-system/ui-system-overview/), or about the Unity UI module in [this documentation](https://makinom.com/guide/documentation/ui-system/unity-ui-module/).

# HUD Scene Setup

First, we'll set up the HUD's game object and components in the scene. At the end we'll create a prefab out of our setup and use it in the HUD setup in the Makinom editor.

We'll show them in the upper left corner of the screen.

Use the context menu in the scene hierarchy to add a simple HUD: *Makinom > UI > HUD > HUD*

## Rect Transform

Change the newly created HUD's *Rect Transform*:

- **Width**
   Set to *200*.
- **Height**
   Set to *100*.
- **Anchors**
   Use the *top left*anchor preset.

Now move it to the upper left corner of the canvas.

Add a *HUD**Text Content* to the HUD using the scene hierarchy context menu: *Makinom > UI > HUD > Content > Text Content (TextMesh Pro)*

Adjust the new game object's bounds to match the parent HUD's bounds (or place it any way you like).

## HUD Text Content Component

This component is responsible for setting the TextMesh Pro component's text in the HUD, we'll use a Makinom text code to show the value of our *lives* int variable.

- **Default Content**
   Set to:
   *Score: <var.int=score>*
   *Turns: <var.int=turns>*
- **Variable Origin**
   Select *Global*.

You can display *int* variables using the text code *<var.int=key>*, replacing *key* with the variable key you want to show.

## TextMesh Pro - Text (UI)

We'll use a larger font size - select the *Text*child object of the created *Text Content*game object and change the *TextMesh Pro - Text (UI)*component's settings.

- **Font Size**
   Set to *30*.

[![](https://makinom.com/wp-content/uploads/makinom2_game_tutorial_match3_hud.png)](https://makinom.com/wp-content/uploads/makinom2_game_tutorial_match3_hud.png)

That's it for the HUD - now create a prefab out of it by dragging the *HUD* game object from the scene hierarchy to the project view (e.g. into *Assets/Tutorial Resources/Prefabs/*).

We need to clean up the *Canvas* and *Event System* that where created by Unity for our UI setup in the scene. In the scene hierarchy, select the *Canvas* and *EventSystem* game objects and delete them (e.g. via the *Delete* key).

# Using the UI Prefab

All that's left to do is use the UI prefab we just set up in Makinom.

## HUD 0: Player Info

Open the Makinom editor, navigate to **UI > HUDs** and select the *Default* HUD that's already been added in the initial project setup. Change the following settings.

### HUD Settings

- **Name**
   Set to *Player Info*.
- **HUD Type**
   Select *Information*.
- **Auto Display**
   *Enable* this setting.

### Information Settings

- **User**
   Select *None*.
- **Display Without User**
   *Enable* this setting.

### Unity UI

- **UI Layer**
   Select *Layer 1*.
- **HUD Prefab**
   Select the *HUD* prefab we created.

And that's it - click on *Save Settings* to save the changes.

The next tutorial will handle [generating the level](https://makinom.com/guide/tutorials/match-3/03-generating-the-level/).
