Book Image

Mastering UI Development with Unity

By : Ashley Godbold
Book Image

Mastering UI Development with Unity

By: Ashley Godbold

Overview of this book

A functional UI is an important component for player interaction in every type of video game. Along with imparting crucial statistical information to the player, the UI is also the window through which the player engages with the world established by the game. Unity's tools give you the opportunity to create complex and attractive UIs to make your game stand out. This book helps you realize the full potential of Unity's powerful tools to create the best UI for your games by walking you through the creation of myriad user interface components. Learn how to create visually engaging heads-up-displays, pause menus, health bars, circular progress bars, animated menus, and more. This book not only teaches how to lay out visual elements, but also how to program these features and implement them across multiple games of varying genres. While working through the examples provided, you will learn how to develop a UI that scales to multiple screen resolutions, so your game can be released on multiple platforms with minimal changes.
Table of Contents (12 chapters)

What this book covers

Chapter 1, Designing User Interfaces, covers basic information related to designing user interfaces. Additionally, a detailed explanation of setting the aspect ratio and resolution of a Unity project is discussed.

Chapter 2, Canvases, Panels, and Basic Layouts, begins exploring the development of a user interface by appropriately laying out UI elements within a Canvas. Panels will be used and an introduction to Text and Images will be provided. The examples included in this chapter show how to lay out a basic HUD, create a permanent background image, and develop a basic pop-up menu.

Chapter 3, Automatic Layouts, discusses how to implement the various automatic layout components to streamline the UI building process. The examples included within this chapter utilize the automatic layout functionality to create a selection menu in the HUD and a gridded inventory.

Chapter 4, The Event System and Programming for UI, explains how to program interactions for graphical and hardware user interfaces. The examples covered in this chapter explain how to use the keyboard to make menus appear and disappear, how to pause the game, and how to create a drag and drop inventory system.

Chapter 5, Buttons, explores the various properties of buttons. The examples in this chapter walk through how to set up keyboard and controller navigation of buttons, how to load scenes when buttons are pressed, how to create animated button transitions, and how to make buttons swap their images.

Chapter 6, Text, Images, and TextMesh Pro-Text, discusses the properties of images and text more thoroughly and demonstrates how to affect their properties via code. The examples at the end of the chapter show how to create a dialog box with text that animates as if it was being typed in, how to create a custom font, how to make horizontal and circular progress meters/health bars, and how to create text that wraps with a gradient.

Chapter 7, Masks and Other Inputs, covers a myriad of UI inputs, as well as masks. Examples showing how to make a scrolling menu and a drop-down menu with images are covered at the end of the chapter.

Chapter 8, Animations and Particles in the UI, is all about animating the UI. The examples in this chapter show how to animate menus to fade in and out, and how to make a complex loot box animation with particles that appear in front of the UI elements.

Chapter 9, World Space UI, showcases how to create UI elements that exist within the game scene as opposed to on the "screen" in front of all in-game items. The examples cover how to create an interactive UI for a 2D scene and interactive, hover health bars for a 3D scene.

Chapter 10, Mobile-Specific UI, showcases interactions that are specific to mobile and touchscreen devices. The examples in this chapter show how to recognize when a portion of the screen is tapped on, how to zoom when the pinch action is performed, how to create press-and-hold or long-press interactions, and how to create static and floating on-screen control pads.