Building UI elements in Unity

Daniel Kirwan
3 min readApr 8, 2021

--

The UI or User Interface of your game is very important in any game to give feedback to the player on what their actions are doing.

One of the best UI systems out there can be found in Ghost of Tsushima on the PS4. Essentially there is no UI on screen when the player is outside of combat and even the way they use a waypoint is non intrusive to the player. They use a guiding wind which is in the 3D space of the game to guide you to a point on the map. My UI for my space shooter will be like that :( but it will have all the points needed for the player to know what is happening in the game.

Building UI elements in Unity can be easy. The easiest way to make a UI element is to right-click in the hierarchy and select UI. This will give you a list of options to choose from to insert. For my main menu I created a text object. Doing this will do three things:

  1. It will create a canvas — This is where all of the UI elements will be displayed
  2. It will create an event system — This helps with monitoring events in the UI, like button clicks
  3. it will create the text object

The main menu of the game has elements that have a little bit of movement. It is not good to use animations with UI elements. Why? Because the animations are called every update whether or not they’re inside the update method. I prefer to use tweens. There is a great free asset for simple movement called LeanTween. This is a great asset that has some lovely tweens to use and it comes with demos as well.

You can see above my UI elements with simple tweens on them that move them to a certain position and with a tween type. Once has a bounce effect and the others are swinging.

The buttons have the same effect on them but 1 has more of a delay than the other.

That’s it for this article. Come back for more next time.

--

--

Daniel Kirwan
Daniel Kirwan

No responses yet