Creating a main menu: part 2 – adding buttons

We have now created the simplest type of UI there is. Let's start adding in some interactive objects with buttons that will allow us to start or close the game while also learning about Layout Groups.

  1. To start off, we will need to create a holder for the buttons we want to create to make it easy for us to add additional options to our HUD with minimal fuss. To do that we will select our Canvas object from the Hierarchy tab and then create a Panel by going to the top toolbar and selecting GameObject | UI | Panel.

    The panel object is simply an object with Rect Transform and an Image component attached that is set to take up the entire screen.

  2. Next let's create a button object. From our canvas object, select ...

Get Building an FPS Game with Unity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.