HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
This PDF will be accessible from your Account page after purchase and requires PDF reading software, such as Acrobat® Reader®.
The eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.
The Unity Engine Tutorial for Any Game Creator
Unity is now the world’s #1 game engine, thanks to its affordability, continuous improvements, and amazing global community. With Unity, you can design, code, and author your game once, and then deploy it to multiple platforms, reaching huge audiences and earning maximum returns. Learning 2D Game Development with Unity® will help you master Unity and build powerful skills for success in today’s game industry. It also includes a bonus rundown of the new GUI tools introduced in Unity’s version 4.6 beta.
With this indispensable guide, you’ll gain a solid, practical understanding of the Unity engine as you build a complete, 2D platform-style game, hands-on. The step-by-step project will get you started fast, whether you’re moving to Unity from other engines or are new to game development.
This tutorial covers the entire development process, from initial concept, plans, and designs to the final steps of building and deploying your game. It illuminates Unity’s newly integrated 2D toolset, covering sprites, 2D physics, game scripts, audio, and animations. Throughout, it focuses on the simplest and lowest-cost approaches to game development, relying on free software and assets. Everything you’ll need is provided.
Register your book at informit.com/title/9780321957726 to access assets, code listings, and video tutorials on the companion website.
Learn How To
Preface xix
Acknowledgments xxv
About the Authors xxvii
Introduction 1
Introduction to Unity 1
Project Wizard 4
Setting Our Project 6
Chapter 1: Setting Up the Unity Development Environment 9
Welcome Screen 9
The Unity Interface 10
Summary 25
Exercises 25
Chapter 2: Understanding Asset Creation 27
File Formats 27
Importing Our Assets 28
Importing Packages 31
GameObjects 33
Components 36
Summary 39
Exercises 39
Chapter 3: Creating 2D Sprites 41
Working in 2D 41
Building Our Sprites 43
Sprite Packing 48
Summary 50
Exercises 50
Chapter 4: Building the Game World 53
Level Design 101 53
Getting around Our Scene 56
Manipulating Objects in Unity 59
Our First Level 64
Continuing On 69
Summary 69
Exercises 70
Chapter 5: The Basics of Movement and Player Control 71
Coding in Unity3D 71
Making the Player Go 72
Setting Up a Basic Follow-Cam 83
Introducing the Input Manager 83
Error Handling and Debugging 85
Summary 93
Exercises 94
Chapter 6: Adding Animations to Our Scene 95
Some Rules for Animation 95
Creating Animations 99
Animation States 108
Working with the State Machine 115
Summary 116
Exercises 117
Chapter 7: Setting Up Player Physics and Colliders 119
Understanding Physics 119
2D versus 3D 120
Physics 2D Settings 122
Rigidbodies 124
Colliders 125
Physics Materials 128
Constraints 129
Summary 134
Exercise 134
Chapter 8: Creating and Applying Gameplay Systems 135
Trigger Volumes in Unity 135
Creating Checkpoints 136
Using Checkpoints with Respawn 140
Creating Collectibles 144
Tracking the Player’s Stats 155
Summary 157
Exercises 158
Chapter 9: Creating Hazards and Crafting Difficulty 159
Creating Your First Enemy 159
Dealing Damage 167
Handling Player Death 177
Expanding on Platforming 178
Creating Your Second Enemy 182
Maintaining Your Enemy Arrangements 187
A Few Words on Challenge 190
Summary 191
Exercises 191
Chapter 10: Creating the Menus and Interface Elements 193
UI Design 193
Unity Native GUI 194
Creating a Splash Screen 198
Title Screen 200
Game Over Screen 201
Game Win Screen 202
HUD 204
Summary 212
Exercise 213
Chapter 11: Applying Effects to the GameObjects 215
Introducing the Shuriken Particle System 215
Modules and Properties of a Particle System 217
Adding Particle Effects to the Game 220
Unity’s Audio System 227
Adding Sound to the Player 231
Adding Sound to the Collectible System 236
Applying Some Extra Polish 238
Summary 246
Exercises 246
Chapter 12: Organization and Optimization 247
Organizing Assets 247
Organizing Scripts and Code 253
Optimizations 261
Summary 267
Exercises 268
Chapter 13: Bringing It All Together 269
Tying the Levels Together 269
Hooking Up the Intro Screens 275
Win or Lose: Getting Back into the Action 277
Building and Deploying the Game 281
Moving Forward 286
Final Words 290
Chapter 14: UGUI 291
UGUI Components 291
Creating Our Example Interface 293
Summary 300
Appendix: JavaScript Code Samples 301
Player Scripts 301
Collectible Scripts 307
Enemy Scripts 309
Game System Scripts 310
GUI Scripts 314
Hazard Scripts 320
System Scripts 322
Index 323