

Getting Started with Unity 5.x 2D
Game Development

Table of Contents
Getting Started with Unity 5.x 2D Game Development
Credits
About the Author
Acknowledgment
About the Reviewer
www.PacktPub.com
Why subscribe?
Customer Feedback
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. A Flat World in Unity
Learning game development
Tower defense games
Designing our game
Getting ready
Remembering the past to build the future
Organizing the project
A 2D world
Sprites
Sprite Renderer
Importing new friends
The Sprite Editor

Manual mode
Automatic mode
Polygonal mode
Sprite Editor for UI-9-slice scaling
Preparing the assets
Scenes as levels
Setting proportions
There is more about the Unity interface
Homework
Summary
2. Baking Cupcake Towers
2D objects
Parenting game objects
Difference between world coordinates and local coordinates
Ordering the different layers with Z-Buffering
Unfolding the map
Layers and tags
Prefabs
The game view
Math background
Scripting in Unity
Creating new scripts
Basics about scripts
Variables
Attributes
Functions
Comments
Execution order
Making sprinkles
The projectile class
Scripting the projectile mother class
Tons of sprinkles through Prefabs
Baking cupcakes towers
What a cupcake tower does
Scripting the cupcake tower
Shooting to the pandas

Upgrading the cupcake tower, making it even tastier
A pre-baked cupcake tower through Prefabs
More about coding in Unity
Static variables
Inheritance
Random numbers in Unity
Homework
Summary
3. Communicating with the Player – the User Interface
Getting ready
Designing the user interface
Programming the user interface
User interface system
Canvas
Screen space – Overlay
Screen space – Camera
World space
Draw order of UI elements
Visual components
The Image component
The Text component
Basic transformations
The Rect Tool
The Rect Transform
Layout components
Fitters
Layout groups
The layout element component
Interaction components
The selectable base class
Interactable option
Transition options
Navigation options
Button
Toggle and Toggle Group
Slider