![]()
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...