How to Unity

Making a UI-Driven Prototype Math Game in Unity

UI elements are so powerful we can even make whole games out of them

Daniele Quero, PhD
4 min readMay 6, 2024

--

In this article, I will show how to use Unity UI elements to build the prototype (no graphical polish) of an educational game: a simple addition exerciser, prompting an “a + b = ?” problem to be solved by the user.

Layout of the Game

The setup is straightforward:

  • a Text for the title
  • two Texts for the “a” and “b” values
  • a Text for the “+” sign
  • a Text for the feedback messages
  • an InputField (only integer numbers) to type the answer.
HorizontalLayoutGroup and ContentSizeFitter components

For tidiness purposes, the Text objects are put in an empty parent, with:

  • a HorizontalLayoutGroup component, for better spacing the objects in line
  • a ContentSizeFitter, to resize the object according to its content (the children).

I designed the game like this:

  • extract a random couple of numbers
  • show them in the Text fields

--

--

Daniele Quero, PhD
Daniele Quero, PhD

Written by Daniele Quero, PhD

A professional developer with passion for game developing and skill-growing. A former Nuclear Physics Researcher who changed his life to pursue his dreams

No responses yet