Unity UI Cookbook
eBook - ePub

Unity UI Cookbook

  1. 284 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Unity UI Cookbook

Book details
Book preview
Table of contents
Citations

About This Book

Over 60 recipes to help you create professional and exquisite UIs to make your games more immersive

About This Book

  • Design and develop interactive and professional user interfaces (UIs) for games in Unity
  • Discover how to implement and deal with various in-game UI elements that will impress your players
  • This practical recipe guide will help you to efficiently create powerful and remarkable UIs using C# code

Who This Book Is For

If you are a game developer with some experience in Unity and C# and want to create the best interactive experience fast and intuitively, then this book is for you. If you are an intermediate game developer or an expert, these recipes will help you bring out the power of the new UI Unity system.

What You Will Learn

  • Implement different kinds of counters and healthbars
  • Deal with timers and find out how to format them
  • Animate and vivify UI elements
  • Handle runtime customizations
  • Add complex Head-up displays (HUDs)
  • Design and implement 3D UIs
  • Integrate minimaps in the UI

In Detail

With the increasing interest in game development, it's essential to design and implement a UI that reflects the game settings and shows the right information to the player. The Unity system is used to create complex and aesthetically pleasing user interfaces in order to give a professional look and feel to a game. Although the new Unity UI system is powerful and quite easy to use, by integrating it with C# scripts, it's possible to realize the potential of this system and bring an impressive UI to games.

This guide is an invaluable collection of recipes if you are planning to use Unity to develop a game. Starting with the basic concepts of the UI components, we'll take you all the way through to creating complex interfaces by including animations and dynamics elements.

Based on real-world problems, these recipes will start by showing you how to make common UI elements such as counters and healthbars. You will then get a walkthrough of how to manage time using timers, and will learn how to format them. You will move on to decorating and animating the UI elements to vivify them and give them a professional touch. Furthermore, you will be guided into the 3D UI world and into HUD scripting. Finally, you will discover how to implement complex minimaps in the interface.

Style and approach

Interactive, easy-to-follow recipes will help you create and implement UIs that make gaming an exhilarating experience.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Unity UI Cookbook by Francesco Sapio in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Games. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785885822
Edition
1

Unity UI Cookbook


Table of Contents

Unity UI Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. UI Essentials
Introduction
Getting ready
Setting up a 2D texture to be a bordered sprite
How to do it...
How it works...
There's more...
Slicing with less than nine sections
See also
Resizing the UI according to the screen size and resolution
How to do it...
How it works...
See also
Adding and placing an image in the UI
How to do it...
How it works...
There's more...
Rotating the image and changing the pivot point
Adding a circular mask to an image
How to do it...
How it works...
See also
Making an image scrollable
How to do it...
How it works...
See also
Making text scrollable with a vertical slider
How to do it...
How it works...
There's more...
Scrolling multiple columns at once
Scrolling horizontally
Selecting buttons through the keyboard
How to do it...
How it works...
See also
Using UI layout components
How to do it...
How it works...
See also
2. Implementing Counters and Health Bars
Introduction
Implementing a score counter
How to do it...
How it works...
There's more...
Adding a remove points function
Using boldface in the rich text
Getting the score
See also
Implementing a lives counter
How to do it...
How it works...
There's more...
Changing the number of maxLives
Getting the number of lives
See also
Creating a modular coin counter
How to do it...
How it works...
There's more...
Removing coins
Adding score if the number of lives has reached the maximum
Getting the number of coins
See also
Creating a symbolic lives counter
How to do it...
How it works...
See also
Implementing a linear health bar
How to do it...
How it works...
There's more...
See also
Implementing a radial health bar
How to do it...
How it works...
There's more...
Having a health bar that isn't necessarily 360°
See also
Creating a health bar with armor
How to do it...
How it works...
See also
Using multiple bars to make a multibar
How to do it...
How it works...
See also
Developing a kingdom hearts health bar style
How to do it...
How it works...
See also
3. Implementing Timers
Introduction
Implementing a numeric timer
How to do it...
How it works...
There's more...
Getting the time variable
See also
Creating a linear timer
How to do it...
How it works...
There's more...
Running code when the timer expires
Creating a double-sided timer
See also
Implementing a radial timer
How to do it...
How it works...
See also
Creating a mixed timer
How to do it...
How it works...
There's more...
Changing the number of decimal points shown
Using a linear timer instead of a radial timer
See also
Creating a well-formatted timer
How to do it...
How it works...…
There's more...
Getting the time variable
See also
Developing a well-formatted countdown that changes
How to do it...
How it works...
There's more...
Getting the time variable
Running code when the time expires
Increasing tension by adding decimal points when the time is close to expiring
See also
4. Creating Panels for Menus
Introduction
Creating a toggle group
How to do it...
How it works...
There's more...
Giving the player the privilege not to choose one of the options
See also
Showing the slider value as a percentage
How to do it...
How it works...
Adding upper and lower bounds to the slider
How to do it...
How it works...
There's more...
Changing the color when a bound is reached
Expressing bounds as a percentage
Limiting the value that we can set in the Inspector
See also
Making UI elements affected by different lights
How to do it...
How it works...
See also
Making a draggable panel
How to do it...
How it works...
There's more...
Creating a draggable area for the panel
See also
Making a resizable panel
How to do it...
How it works...
See also
Creating a drag-and-drop element
How to do it...
How it works...
There's more...
Checking for dropped objects
Developing an MP3 player
How to do it...
How it works...
There's more...
Showing the name of the song
5. Decorating the UI
Introduction
Creating an extendable element with a final fade effect
How to do it...
How it works...
There's more...
Changing the speed for each axis
Fade-in instead of Fade-out
See also
Creating an extendable and rotating element with a final fade effect
How to do it...
How it works...
There's more...
Creating a shining effect
Creating a better shining effect
Using more than one axis to create 3D effects
Having control over each axis
Creating a butterfly
See also
Creating bars that go up and down
How to do it...
How it works...
There's more...
Adding a phase to use more than one bar
Adding bounds to our bar
Adding bounds and a phase
See a...

Table of contents

  1. Unity UI Cookbook