Book Image

Building an FPS Game with Unity

5 (1)
Book Image

Building an FPS Game with Unity

5 (1)

Overview of this book

Table of Contents (18 chapters)
Building an FPS Game with Unity
Credits
Foreword
About the Author
Acknowledgment
About the Reviewers
www.PacktPub.com
Preface
Index

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 GameObject | UI | Button.

    The button that we just created actually consists of two objects: the button itself, which has the background image, and a button script that dictates how it animates and interacts. It also has a child text object that...