Chapter 2. Creating GUIs

A Graphical User Interface (GUI) is the way players interact with your games. You've actually been using a GUI in the previous chapter and also to interact with the operating system of your choice. You wouldn't be able to make your electronics do anything without the use of a GUI such as a command prompt similar to DOS and UNIX.

When working on GUIs, we want them to be as intuitive as possible and only contain the information that is pertinent to the player at any given time. There are people whose main job is programming and/or designing user interfaces and they have college degrees on the subject. So, although we won't talk about everything that we have to work with on GUIs, I do want to touch on the aspects that should be quite helpful when working on your own projects in the future.

Project overview

Over the course of this chapter, we will be expanding on our twin-stick shooter by adding additional UI elements that will include a main menu, a pause menu, and an options menu and will give us the ability to restart our project. It is important to note that unlike the previous edition of this book, in this second edition of the book we will be creating these menus using the new UI system that was introduced in Unity 4.6.

Your objectives

This project will be split into a number of tasks. It will be a simple step-by-step process from beginning to end. Here is the outline of our tasks:

  • Creating a main menu
  • Customizing the GUI
  • Implementing a pause menu
  • Restarting the game
  • Adding an Options screen

Prerequisites

This chapter assumes that you have completed the previous chapter and are working with that project. If you have not completed the project yet, please use the Twinstick Shooter folder from Chapter 1's example code and open it up in Unity.

We will also need some graphical assets for use in our project. These can be downloaded from the example code provided for this book on the Packt Publishing website.

Browse through the code files; inside the Chapter 2 folder, there are a number of things, including an Art Assets folder that will have the art, sound, and font files that you'll need for the project as well as the Twinstick Shooter with GUI folder which contains the final project.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset