0% found this document useful (0 votes)
18 views69 pages

6310

The document promotes various eBooks available for instant download at ebookball.com, focusing on Unity game development across different editions and topics. It includes titles such as 'Unity 2017 2D Game Development Projects' and 'Mastering Unity 2017 Game Development', offering full chapters in PDF format. The eBooks cover practical game development techniques and are accessible in multiple formats for reading on any device.

Uploaded by

nogulasolloy36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views69 pages

6310

The document promotes various eBooks available for instant download at ebookball.com, focusing on Unity game development across different editions and topics. It includes titles such as 'Unity 2017 2D Game Development Projects' and 'Mastering Unity 2017 Game Development', offering full chapters in PDF format. The eBooks cover practical game development techniques and are accessible in multiple formats for reading on any device.

Uploaded by

nogulasolloy36
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Quick and Easy Ebook Downloads – Start Now at ebookball.

com for Instant Access

(Ebook PDF) Unity 2017 2D game development


projects create three interactive and engaging 2D
games and Unity 2017 1st edition by Lauren Ferro,
Francesco Sapio 1786460270 978-1786460271 full
chapters
https://ebookball.com/product/ebook-pdf-unity-2017-2d-game-
development-projects-create-three-interactive-and-
engaging-2d-games-and-unity-2017-1st-edition-by-lauren-
ferro-francesco-sapio-1786460270-978-1786460271-full-
chapters-2266/

OR CLICK BUTTON

DOWLOAD NOW

Instantly Access and Download Textbook at https://ebookball.com


Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

(EBook PDF) Unity 2D Game Development Cookbook Over 50


hands on recipes that leverage the features of Unity to
help you create 2D games and game prototypes 1st edition
by Scolastici Claudio 9781783553600 full chapters
https://ebookball.com/product/ebook-pdf-unity-2d-game-development-
cookbook-over-50-hands-on-recipes-that-leverage-the-features-of-unity-
to-help-you-create-2d-games-and-game-prototypes-1st-edition-by-
scolastici-claudio-978178355360/
ebookball.com

(Ebook PDF) Mastering Unity 2017 Game Development and C


Create professional games and solid gameplay features and
professional 2nd edition by Alan Thorn 1788398394
9781788398398 full chapters
https://ebookball.com/product/ebook-pdf-mastering-unity-2017-game-
development-and-c-create-professional-games-and-solid-gameplay-
features-and-professional-2nd-edition-by-alan-
thorn-1788398394-9781788398398-full-chapters-22602/
ebookball.com

(Ebook PDF) Unity 2017 Mobile Game Development Build


deploy and monetize games for Android and iOS with Unity
1st edition by John Doran 1787286770 9781787286771 full
chapters
https://ebookball.com/product/ebook-pdf-unity-2017-mobile-game-
development-build-deploy-and-monetize-games-for-android-and-ios-with-
unity-1st-edition-by-john-doran-1787286770-9781787286771-full-
chapters-22670/
ebookball.com

(Ebook PDF) Learn Unity 2017 for iOS Game Development


Create Amazing 3D Games for iPhone and iPad 2nd edition by
Allan Fowler, Philip Chu 1484231740 9781484231746 full
chapters
https://ebookball.com/product/ebook-pdf-learn-unity-2017-for-ios-game-
development-create-amazing-3d-games-for-iphone-and-ipad-2nd-edition-
by-allan-fowler-philip-chu-1484231740-9781484231746-full-
chapters-22692/
ebookball.com
(Ebook PDF) Unity 2018 By Example Learn about game and
virtual reality development by creating five engaging
projects 2nd Edition by Alan Thorn 1788479327
9781788479325 full chapters
https://ebookball.com/product/ebook-pdf-unity-2018-by-example-learn-
about-game-and-virtual-reality-development-by-creating-five-engaging-
projects-2nd-edition-by-alan-thorn-1788479327-9781788479325-full-
chapters-22598/
ebookball.com

(Ebook PDF) Hands On Unity 2020 Game Development Build


customize and optimize professional games using Unity 2020
and C# 1st edition by Nicolas Alejandro Borromeo
1838647600 9781838647605 full chapters
https://ebookball.com/product/ebook-pdf-hands-on-unity-2020-game-
development-build-customize-and-optimize-professional-games-using-
unity-2020-and-c-1st-edition-by-nicolas-alejandro-
borromeo-1838647600-9781838647605-full-chapters-2/
ebookball.com

(Ebook PDF) 2D iOS and tvOS Games by Tutorials Beginning


2D iOS and tvOS Game Development & Swift 2 1st edition by
Mike Berg, Michael Briscoe, Ali Hafizji
1942878141Â 978-1942878148 full chapters
https://ebookball.com/product/ebook-pdf-2d-ios-and-tvos-games-by-
tutorials-beginning-2d-ios-and-tvos-game-development-swift-2-1st-
edition-by-mike-berg-michael-briscoe-ali-
hafizji-1942878141-978-1942878148-full-chapters-22604/
ebookball.com

(Ebook PDF) Practical Game Development With Unity and


Blender 1st edition by Alan Thorn B012HUEULU full chapters

https://ebookball.com/product/ebook-pdf-practical-game-development-
with-unity-and-blender-1st-edition-by-alan-thorn-b012hueulu-full-
chapters-22694/

ebookball.com

(Ebook PDF) Learn Unity for Android Game Development A


Guide to Game Design, Development and Marketing 1st
edition by Adam Sinicki 1484227042 9781484227046 full
chapters
https://ebookball.com/product/ebook-pdf-learn-unity-for-android-game-
development-a-guide-to-game-design-development-and-marketing-1st-
edition-by-adam-sinicki-1484227042-9781484227046-full-chapters-22696/

ebookball.com
Unity 2017 2D Game
Development Projects

Create three interactive and engaging 2D games with Unity


2017

Lauren S. Ferro

Francesco Sapio

BIRMINGHAM - MUMBAI
Unity 2017 2D Game Development Projects
Copyright © 2018 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form
or by any means, without the prior written permission of the publisher, except in the case of brief quotations
embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented.
However, the information contained in this book is sold without warranty, either express or implied. Neither the
authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to
have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products
mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy
of this information.

Commissioning Editor: Amarabha Banerjee


Acquisition Editor: Larissa Pinto
Content Development Editor: Mohammed Yusuf Imaratwale
Technical Editor: Shweta Jadhav
Copy Editor: Safis Editing
Project Coordinator: Hardik Bhinde
Proofreader: Safis Editing
Indexer: Tejal Daruwale Soni
Graphics: Jason Monterio
Production Coordinator: Aparna Bhagat

First published: January 2018

Production reference: 1180118

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.

ISBN 978-1-78646-027-1

www.packtpub.com
mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as
well as industry leading tools to help you plan your personal development and advance
your career. For more information, please visit our website.

Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos
from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and
ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a
print book customer, you are entitled to a discount on the eBook copy. Get in touch with us
at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a
range of free newsletters, and receive exclusive discounts and offers on Packt books and
eBooks.
Contributors

About the authors


Lauren S. Ferro has a PhD in player modeling. She works as a gamification consultant and
designer in many different industries. She is an active researcher in user-/player-
centered design. Lauren runs game workshops that focus on designing user-
centered gaming experiences. She is also the creator of a game design resource, Gamicards,
which is a prototyping tool for game experiences. She is passionate about the future of
games, their technologies, and their potential to improve people's lives.

Packt Publishing - For the opportunity to write this book and be a part of the authoring
community.
Francesco Sapio - For your help and guidance throughout this book.
Andreas Oehlke - For your time, comments, and suggestions.
My family - For their motivation and encouragement.
You, the reader - I hope that this book takes you on marvelous and intrepid adventures.

Francesco Sapio has a Master's of Science, summa cum laude in engineering with a focus on
AI and Robotics. Now, he is a PhD researcher.

He is a Unity and Unreal expert. Among many projects, he has developed Gea2 (Sapienza)
and Sticker Book (Dataware Games), and has consulted for Prosperity – Italy 1434
(Entertainment Game Apps, Inc) and Projekt I.D (RMIT).

He is an active writer on game development, authoring Getting Started with Unity 5.x 2D
Game Development, Unity UI Cookbook, and many other books.

Finally, Francesco loves math, philosophy, logic, puzzle solving, and, most importantly,
creating video games.

I'm deeply thankful to my family for their enthusiasm and support throughout my life;
they have always encouraged me to do better, using the Latin expressions "Ad maiora" and
"Per aspera ad astra" as motivation.
I'm glad to have worked with Lauren Ferro; it has been a pleasure.
Finally, a huge thanks to all the special people around me whom I love, in particular to my
girlfriend; I’m grateful for all of your help with everything.
About the reviewer
Andreas Oehlke is a professional software engineer and computer scientist who feels very
much at home on any Linux/UNIX machine. He holds a bachelor's degree in computer
science and loves to assemble and disassemble both software and hardware. His trademark
has always been his enthusiasm and affinity for electronics and computers. His hobbies
include game and web development, programming in general (software design and new
languages), programming embedded systems with microcontrollers, sports, and making
music.

He currently works full-time as a senior software engineer for a German financial


institution. Furthermore, and has worked as a consultant and game developer in San
Francisco, CA. He is also the author of the book Learning LibGDX Game Development. In his
spare time, he shares his expertise with a German start-up called Gamerald.

Packt is searching for authors like you


If you're interested in becoming an author for Packt, please visit authors.packtpub.com and
apply today. We have worked with thousands of developers and tech professionals, just
like you, to help them share their insight with the global tech community. You can make a
general application, apply for a specific hot topic that we are recruiting an author for, or
submit your own idea.
Table of Contents
Preface 1
Chapter 1: Press Start 6
Atoms of games 7
Different approaches to games 8
The game design process 9
Workflow 9
Concept development 10
Design and prototyping 11
Implementation 12
Testing 12
Iteration 13
Finalizing 13
A-Team 13
Developing 2D games 14
X, Y, and Z-axis 15
Full 3D 15
Orthographic (3D) 16
2D with 3D graphics, also known as 2.5D 17
Full 2D 18
2D with a perspective camera 20
The Unity Engine 21
Downloading Unity 21
An overview of built-in features in Unity 24
Creating a new 2D project in Unity 25
A brief overview of the Unity User Interface (UI) 26
The main components of the UI in Unity 27
Hierarchy Window 27
Scene View 29
Game View 30
Inspector window 30
Console window 32
Project Window 33
Customizing the workspace 33
Hotkeys to keep in mind 36
Primitive and placeholder objects 37
Images 38
3D model files 39
Meshes and animations 39
Table of Contents

Audio files 40
Naming conventions for assets (and in general) 40
Importing into Unity 40
Special folders 40
Assets 41
Editor 42
Editor default resources 43
Plugins 43
Gizmos 44
Standard Assets 45
StreamingAssets folder 47
Resources 47
Hidden Assets 48
Preparing for the projects in this book 48
Project 1 - Angel Cakes 48
Project 2 - intergalactic shooter: Quark 49
Project 3 - RETROformer 49
Summary 49
Chapter 2: Working with Assets 50
An overview of collecting games 52
Key features of collecting in games and things to keep in mind 53
What will you learn in the remainder of this chapter? 53
Textures and Sprites 54
Sprite Render 55
Sprite Editor 55
How to use the Sprite Editor 55
Sprite Packer 58
Sprite Creator is your friend when you have no assets 59
Setting up the Angel Cakes project 64
Folder setup 66
Importing assets into the engine 66
Configuring assets for the game 67
9-slicing Sprites 76
Best practices 84
Textures 84
Maximizing the space that you have 85
Scaling 85
Naming 86
Summary 86
Chapter 3: Let’s Make Some Prefabs 87

[ ii ]
Table of Contents

Basics of audio and sound FX in Unity 88


Importing audio 90
Audio Listener 90
Audio Source 91
Choosing sounds for background and FX 92
Happy 93
Sad 93
Retro 93
Integrating background music in our game 94
Creating the Angel and the PlayerController 95
A brief overview of Unity's physics system 96
Rigidbody 96
Colliders 97
Assembling the Angel 98
Tagging the player 99
Creating the Script 100
Enforcing components 101
Exposing variables in the inspector 102
From the player input to a new position in the world 104
Moving the character to the new position 105
Testing the PlayerController 106
Collectable system 106
Setting up the Angel Cakes 106
Enforcing components, again! 108
Triggering cake 109
Testing the cake collectable system so far 111
Prefabs for our Game Objects 112
Creating the Prefab for the player and the cake 112
Building the Map 113
Summary 116
Chapter 4: It’s about U and I 117
Overview of the UI 118
Designing the user interface 119
Programming the user interface 120
Four types of UI 121
Diegetic 122
Non-diegetic 123
Spatial 124
Meta 124

[ iii ]
Table of Contents

Usability and function 125


UI is not UX 126
Designing UIs for games 126
Feedback 126
Be bold, not ambiguous 128
Keep it simple, consistent, and focused 130
Ergonomics: devices, hardware, and gestures 130
Multi-device design 130
Meaning and integrity 131
Goals 131
Enjoyment 131
Test 131
Introduction to the UI system in Unity 131
Building UIs in Angel Cakes 132
Scripting a UI and integrating with the collection systems 132
Setting up the UI 133
Programming the scoring system 136
Increasing the score when the player collects a cake 137
Creating a Game Over Screen 138
Scripting the Game Over Screen 139
Last tweaks 140
Testing 141
More kinds of cakes 141
Adding more levels 142
Adding animations 142
Devils 143
Summary 143
Chapter 5: Freeze! Creating an Intergalactic Shooter 145
An overview of game #2 146
Overview of shooting games 147
First-Person 147
Third-Person 148
Top-down 148
Designing game #2 149
Setting up the project for game #2 150
Importing assets for the space shooter 150
Organizing the project 151
Introduction to the animation system 152
Concepts of Sprite animations 153

[ iv ]
Table of Contents

Generating the animations from the sprites 156


Adding a state behavior for destroying the explosion 158
Saving the explosion as a prefab 161
Summary 161
Chapter 6: No One Is Alone Forever 162
Creating a shooting system 163
Player controller 163
Requirements of the player controller 163
Creating the script 164
Moving the player 165
It's time to shoot 167
That explosion was bad 168
Testing the explosion 169
Enemy controller 171
Requirements of the enemy controller 171
Creating the enemy controller 171
New variables for the enemy controller 172
Modifying the movement 172
Shooting deadly bullets 174
Alternative enemy controller 174
Creating the second enemy controller 175
Changing the aiming system 175
Shooting with passion 176
Creating a bullet prefab 177
Creating a bullet controller 178
Enforcing components 178
Exposing variables in the Inspector 178
Getting the reference to the rigidbody 179
Auto-destroying the bullet 180
Moving the bullet 180
Hit spaceships 181
Exercises 182
Summary 183
Chapter 7: Getting Serious About Gameplay 184
Building the UI 185
Setting up the UI 185
Creating the lives counter 187
Creating the star score counter 191
Building an infinite scrolling map 192

[v]
Table of Contents

Repeating the background 192


Falling stars and planets 195
Rotating satellites 196
Creating the prefabs 197
Including power-ups 197
Spawning system 199
Coroutines 199
Creating spawning points 199
Scripting the spawning system 200
Testing the game 203
Exercises 203
Other things you could consider adding to the game 205
Timer 205
Increase the speed 205
Combos 205
Bosses and waves 205
Summary 206
Chapter 8: Building a Tilemap and Importing it into Unity 207
Platforming games 207
Side-scrolling 208
Infinite scrolling/endless runner 208
Overview of the project for game #3 - RETROformer 208
Creating tiles 209
Introduction to the program - Tiled and Tiled2Unity 209
Mini-map 222
Changing level properties 222
Adding colliders to our tiles 224
Importing tilesets into Unity with Tiled2Unity 225
Post-Tiled2Unity 228
Summary 229
Chapter 9: Look, It Moves 230
Advanced animations 231
A short recap of the animation system 231
Setting up the sprite sheet for the animations 233
Creating the animations from the sprite sheet 237
Building the Animation State Machine 238
Summary 245
Chapter 10: Let’s Get Physical 246

[ vi ]
Table of Contents

Physics Material 2D 247


Building the panda hero 252
Moving the panda 259
The control scheme 259
The Movement Component 260
Setting up the Movement Component 265
Player Controller 265
Summary 267
Chapter 11: Don’t Forget to Save! 268
Save and load systems 268
Creating a save/load system in Unity 269
PlayerPrefs 270
PlayerPrefs functions 271
Variables to save in RETROformer 272
Building the save/load system for our game 273
Refining the save and load system 276
Jump pads 277
Creating the Jump Pad 277
Wrapping up gameplay 281
Creating the user interface 281
Water zones 282
Winning zone 286
Enhancing the environment 287
Testing 289
Summary 289
Chapter 12: The Nature of Export 290
Implementing mobile input for the game 290
MovingController 291
JumpController 294
Exporting the game 296
For Android 298
Preparing an Android Unity project 299
Summary 306
Other Books You May Enjoy 307
Index 310

[ vii ]
Preface
Welcome to the world of 2D game development in Unity. In this book, we will explore how
to use the powerful 2D features of the Unity engine to create three amazing games. You will
learn many different skills throughout this book. Not only will these skills be applied to the
games within this book, but they will provide you with a foundation for developing your
own games.

With this said, let's get started!

Who this book is for


This is a book for game developers interested in building stunning 2D games from scratch.
You will need to have a basic familiarity with game development techniques to get the most
out of this book. However, no prior knowledge of Unity is expected or required, although
having some programming skills, especially with C#, is preferable.

What this book covers


Chapter 1, Press Start, is our first chapter and will provide you with a primer about what
game design and development are involved. This chapter offers an overview of the three
different games that will be made throughout the book.

Chapter 2, Working with Assets, will get you started with Unity. This chapter begins with
our first game—Angel's Cakes—and continues by explaining the importation of assets so
that you can set up the foundations of the game (and others) within the book.

Chapter 3, Let's Make Some Prefabs, continues the development of our first game by
introducing fundamental concepts in Unity. It also explains how to start scripting with C#
to create most of the gameplay of this first project.

Chapter 4, It's about U and I, wraps up the first game of the book, and will guide you
through understanding User Interfaces (UIs) in Unity.

Chapter 5, Freeze! Creating an Intergalactic Shooter, marks the beginning of the second game
of this book, which, as the title suggests, will take place in outer space. This chapter will also
introduce the animation system of Unity.
Preface

Chapter 6, No One Is Alone Forever, is all about adding a bit more substance to our shooter
by integrating AI enemies into the rest of the game.

Chapter 7, Getting Serious About Gameplay, further iterates on the second game by
implementing other core game mechanics as well as various suggestions and explanations
on how to improve it.

Chapter 8, Building a Tilemap and Importing It into Unity, introduces a third-party tool for
creating tilesets. Furthermore, you will learn how to incorporate these tiles into Unity to
build 2D worlds for your third game.

Chapter 9, Look, It Moves, starts the actual development of the third and last game of this
book by expanding the concepts learned for animation state machines and extending them
for the main hero animation system.

Chapter 10, Let's Get Physical, focuses on some concepts of Physics 2D in Unity, and how
these can be helpful to finish up the gameplay of the third game, in particular, to create a
movement system that will work on both desktop computers and mobile devices.

Chapter 11, Don't Forget to Save!, outlines how to permanently store the data of your
games, and how to use these techniques to create a save/load system.

Chapter 12, The Nature of Export, dives into how to export the games you made, especially
the third one, to be played either as a standalone (Windows, Linux, or Mac) or on mobile
devices, such as Android.

To get the most out of this book


In order to get the most out of this book, it's preferable that you have had some experience
with some programming languages (specifically C#). Although this book will teach you
how to script in Unity, this is not a programming book. In saying that, this book does not
assume that you have any prior knowledge of Unity, scripting, or the other free programs
that we will use (in Chapter 8, Building a Tilemap and Importing It into Unity). As a result, I
highly recommend that you jump into the first chapter and start exploring the book. In fact,
you can always revise sections of this book once you have developed your skills and
understanding.

[2]
Preface

Download the example code files


You can download the example code files for this book from your account at
www.packtpub.com. If you purchased this book elsewhere, you can visit
www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

1. Log in or register at www.packtpub.com.


2. Select the SUPPORT tab.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box and follow the onscreen
instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the
latest version of:

WinRAR/7-Zip for Windows


Zipeg/iZip/UnRarX for Mac
7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https:/​/​github.​com/
PacktPublishing/​Unity-​2017-​2D-​Game-​Development-​Projects. We also have other code
bundles from our rich catalog of books and videos available at https:/​/​github.​com/
PacktPublishing/​. Check them out!

Download the color images


We also provide a PDF file that has color images of the screenshots/diagrams used in this
book. You can download it here: http:/​/​www.​packtpub.​com/​sites/​default/​files/
downloads/​Unity20172DGameDevelopmentProjects_​ColorImages.​pdf.

Conventions used
There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames,
file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an
example: "Increase the cakesCollected variable every time the player collects a cake."

[3]
Preface

A block of code is set as follows:


void FixedUpdate () {
//Get the new position of our character
var x = transform.position.x + Input.GetAxis("Horizontal") *
Time.deltaTime * speed;
var y = transform.position.y + Input.GetAxis("Vertical") *
Time.deltaTime * speed;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines
or items are set in bold:
void Start() {
rigidBody = GetComponent<Rigidbody2D>();
}

Bold: Indicates a new term, an important word, or words that you see onscreen. For
example, words in menus or dialog boxes appear in the text like this. Here is an example:
"Select System info from the Administration panel."

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch
Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the
subject of your message. If you have questions about any aspect of this book, please email
us at [email protected].

[4]
Preface

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you have found a mistake in this book, we would be grateful if you would
report this to us. Please visit www.packtpub.com/submit-errata, selecting your book,
clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we
would be grateful if you would provide us with the location address or website name.
Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in
and you are interested in either writing or contributing to a book, please visit
authors.packtpub.com.

Reviews
Please leave a review. Once you have read and used this book, why not leave a review on
the site that you purchased it from? Potential readers can then see and use your unbiased
opinion to make purchase decisions, we at Packt can understand what you think about our
products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.

[5]
Press Start
1
Welcome. You are at the beginning of your journey into the world of 2D game
development. Throughout this book, we will explore many things that the world of 2D
games can offer and how to design exciting adventures. This book not only explains what to
do in Unity but also what is involved in the game design process. In this way, you will have
a solid foundation in game design and development.

In some instances throughout this chapter and the rest of the book, there are various links to
resources (such as Unity documentation). In many of these instances, both the link and a QR
code are provided. The intention here is to save time entering the URL into your browser if
you are reading a hard copy of this book. Now with that said, this is what we will cover in
this chapter:

Game design
The game design process
Developing 2D games
Unity Engine
Creating new projects in Unity
Preparing for the projects in this book
Key tips and best practices for 2D (and general) game development
Additional game design exercises to develop your skills as a game designer

By the end of this chapter, you will have achieved the following:

Have a general understanding of game design and the processes involved in


making a game
Know how to download and set up Unity
Press Start Chapter 1

Know how to configure Unity for a 2D game project

Now, let's begin our journey.

Game design is an exciting adventure that draws from many different disciplines, such as
programming, art, design, audio, and creative writing. This may be overwhelming,
especially if you're new to game design. You may think "but I am neither a programmer nor
a creative writer, and I can't draw to save my life!" If you have a passion for games, then
game design is possible. However, it is not for the weary. Game design will challenge you
and it will test your patience. However, I promise you that the feeling you get from learning
how to make your first character move with text in a script, to having that character collect
coins, shoot enemies, and finish a level is an extremely rewarding experience.

This book does not assume that you know anything about creating games or any of the
skills that are associated with game development. Over the course of the book, you will
learn the basics of programming in C#, how to create three different types of 2D games in
Unity, and a whole lot more about the game design process in general. Fear not about the
art or the sound, as we will be using some free asset packages and sounds so that you can
create something magical. Of course, if you dare to push yourself, I encourage you to
dabble in these areas, as even a basic level of understanding goes a long way.

Atoms of games
We can think of game designers like chemists, except chemists that create mixtures of
entertainment, emotionally driven narratives, and exciting experiences. If you think back to
chemistry in high school, we all learned that some things make smoke, other things make
bubbles, and a few things when combined make explosions; games work in a similar way,
just with different substances (for example, game elements and mechanics).

When it comes to the distinction between these substances, namely game elements, and
mechanics, there are many interpretations of what they are and what they are made up of.
For the purpose of this book, when a player performs an action, they are likely to get
something. This could range from a Badge, Point(s), Levels, or part of a Story. The "thing"
that the player gets is what we will define as a "game element". Of course, there are many
different examples of and perspectives on what game elements are, but for the purposes of
this book, this will be our definition.

On the other hand, since game elements are the outcome, then the process of how we get
them is what we will define as game mechanics. This could be anything from trading with
other players, exploring mysterious worlds, and even Winning or Losing. Performing or
engaging in these actions will result in obtaining game elements.

[7]
Press Start Chapter 1

When you're playing games, think about things that you are receiving
during gameplay and how you get them. By being a bit more conscious
during your own experiences and reflecting on them, you not only
develop an awareness of the "reactions" that certain game elements and
mechanics afford, it also provides you with a way to consider
implementing these into your own games. As a result, you will learn how
different combinations create different outcomes.

Different approaches to games


Games are enjoyable to play, we play them to entertain ourselves and friends. Over many
decades, as games have developed along with the technologies that make them available,
the context of their uses has also evolved. For example, most games are created to entertain
us (for example, Assassin's Creed). That is, there is no underlying intention, such as to
supplement/support curriculum material or teach us about science (for example, Ludwig) all
the way to operational health and safety. Finally, there are games that have been developed
for entertainment but have ended up being used for more intuitive reasons. This is because
of the educational potential that they afford (for example, Minecraft and Sid Meier's
Civilization series) some games that have been created for entertainment purposes have
provided ways for students to learn and practice various topics. Lastly, there are game-like
experiences or "gamified" experiences that apply game design principles to achieve
everyday tasks, from becoming more productive at work, eating better and maintaining a
healthier lifestyle, to managing finances and developing new skills (for example, Habitica).

If you want to learn all about gamification in Unity, I encourage you to have a
look at Gamification with Unity 5.x. You can get an eBook or hardcopy
version by going to the following link or scanning the QR code: https:/​/​www.
packtpub.​com/​game-​development/​gamification-​unity-​5x.

Now that we have a brief understanding of what games are made of and their use in
different contexts, it's time to understand the game design process.

[8]
Press Start Chapter 1

The game design process


As I mentioned before, there are many things that define what is game design. For example,
it is an opportunity to transport players to realities that we can only imagine to be people
that we may only dream of. However, just as important as what it is and isn't, is how it is
done. Generally speaking there is a systematic approach that game designers follow to
create a game. It begins with the "idea"—the concept of what the game will be. This is
usually not static and will change over the course of a game's development. From there, and
depending on who is on your team, it will go through many design phases before becoming
a prototype. Beyond the prototype phase, the actual game will enter the development
process where the actual assets (and not placeholders) will be created and implemented.
From this point, the game will go through an iterative cycle, where the game will undergo
playtesting, changes, more playtesting, more changes, and then eventually it will be refined
to the point where it will enter the last stages. Here, we will briefly explore each of these
stages.

Workflow
The workflow process of game design is linear in the sense that there is an order that it
takes place: concept development, prototyping, implementation, testing, and hitting
release. This concept is illustrated here:

[9]
Press Start Chapter 1

Of course, the diagram only outlines the process in general. As you develop games and
work with others, you will find that this process loops in many other parts. Sometimes,
through designing and prototyping your concept, you may end up having to change the
initial idea. The important thing to remember is that while to some extent game design is a
linear process, in terms of developmental stages, these stages do and will often form
iterative cycles.

Concept development
We begin the process of game design by first brainstorming and then designing and
prototyping a concept. The ideas at this stage can be adventurous, out there, and completely
bizarre, because anything goes. It may be useful to get yourself a small notebook to write
down your thoughts because they will come to you at any moment. Another thing to think
about is who you are designing this game for. Do you know enough about them or do you
need to do a bit more research? Defining your demographics early on can help when it
comes to refining your idea. For example, if the people you are designing play role-playing
games (RPGs) then they are likely to prefer a detailed narrative and character
customizations, as opposed to premade characters and a simple story. Therefore, the kind of
environment, what kind of narrative that it can afford, and the characters that you will
create (and possible options for them) will need to be thought about while you're
brainstorming ideas.

Some useful tips when it comes to concept development are listed here:

Keep all your ideas in a journal or somewhere safe so that you can refer to them
later.
Challenge yourself if you're stuck with ideas on what kind of game to create.
Choose the first thing that comes to your mind, flip a dictionary and choose a
word at random; there are many ways to really push your creativity.
Play games that you wouldn't normally play, and if you don't play, then start!
By playing more games in different contexts and on different platforms (mobile,
PC, PlayStation, and so on), you will begin to learn how experiences change
depending on the hardware you're using to interact with. Pay attention to how
the player controls differ between a mobile and console game. These little things
will help you later when you start to design and prototype your game.
Deconstruct games, identify the core features, and remake them. At the end of
this chapter, there is a nice exercise for doing this but really think outside of the
box. The aim is to be inventive, to create something new with the same concept.

[ 10 ]
Press Start Chapter 1

Learn about games! Don't just become the game designer, become a researcher,
an explorer of games. Invest a little bit of time to learn what other game designers
have done, how they have done it, what worked or didn't. There are many
postmortem videos about games that explain the development process. In
addition, it also gives you a bit more insight into the overall game design process
and the roles and responsibility that each team member has. In this way, if you're
thinking about creating a small (or large) team, you can understand what's
involved.
Be critical, be judgmental! If you played a game and didn't like, identify why that
was. Was it the controls, perhaps the story was boring? Then take the guise of the
designer, and think about how you would fix it: would you change or remove
something, how would you make it better?

Unfortunately, we won't be covering this stage in the book, as everything


that we will be using in our projects is pre-made. However, what I do
encourage you to do is that after you have learned about the projects that
we will be doing in this book, brainstorm your own version of them.
Instead of Angel Cakes (project 1), develop something that is to do with
zombies or even fish! By doing this, you will be able to practice the first
stage of game development and develop your brainstorming and
conceptualization of game ideas.

Design and prototyping


This is where those crazy ideas become a bit more refined. You begin to weed through all
your ideas, deciding which ones are feasible, which ones are not appropriate for your
intended audiences, and so on. Start with pen and paper and draw out your game. You
don't need to be an artist; prototyping is rough, it's messy, it is completely raw. Don't get
caught up in how neat it looks. The point at this stage is to get what's in your head out on
paper. Other things that you might find useful during the prototyping stage are post-it
notes, colored pens, scissors, dice, counters (for example, beads, buttons, stones, and so on),
other game bits and pieces (for example, Monopoly money, figurines, and so on). During the
prototyping stage, you will want to also see how the interaction flows through the game.
For example, does the interaction feel difficult in the sense you can't do or get something
that you want to? Perhaps the game feels a bit too easy or hard? At this stage, these are
considerations that you will also need to iron out when it comes to properly playtesting
your game, so don't worry too much if they still don't feel completely right.

[ 11 ]
Press Start Chapter 1

Since we won't be actively designing or prototyping the games in this


book, you might want to think about how you would prototype them. One
way to do this is to redesign them with your own ideas and then refine
them through the design and prototype stage so that you can get a better
understanding of this process.

Implementation
This is where you will transfer what you've conceptualized, designed, and prototyped into
the actual game. Generally, this is where you begin integrating it into the game engine,
working on the actual models that will feature in the game. At this point, you're no longer
prototyping, but developing the game. From here on out, you should have a clear idea of
what your game is and how it will work from beginning to end. Once you have begun
implementing your assets into the actual game, you will go through various iterations.
These iterations will often occur after playtesting, albeit informal or formally done (for
example, open/closed alpha, beta testing). The projects in this book will start at this stage.
This is because we already have assets ready for you to use. But it is important to know at
what stage of the game development process that implementation is at.

Testing
This is probably the most important part. If you haven't already been doing this, then I
would suggest that you stop what you're doing and start. Testing is such an important step
in the process because it helps to make sure that your game runs smoothly and efficiently.
Not only this, it can raise issues relating to player engagement, glitches/bugs/exploits within
your game that can give other players an advantage when it comes to game time (especially
in multiplayer games). We will cover playtesting in a later chapter, so we won't go into too
much detail now.

[ 12 ]
Press Start Chapter 1

Iteration
While you're testing, you will also need to iterate your design. Iterations may be minor,
such as the location of objects, others may be large, such as changing the structure of a level
or redoing the animation of a character. At this stage, it's about refining what your game is
to make it what you want it to become. Each iteration is an improvement that will come
with more testing. This is why testing is also very important because, without it, you're not
able to refine and improve, or even fix part of your game, so that it gets to the stage that you
envisioned it at from the beginning. Of course, you will get to a point where you find a
minor change here and another one there, and you may even get caught up in the pursuit of
perfection. All game designers have reached that point, so it's a common feeling of wanting
"completeness" to the point of perfection, but it rarely comes. So when you get to this stage,
you need to let go and move on. Otherwise, you will never complete any game, ever!

Finalizing
This is the polishing stage where you will begin to fine-tune what has already been
implemented. This can include a range of different things from tweaking post-processing
effects to character speeds. This is the final stage before you release your game on your
targeted platform to the public. We will discuss this as we go with each of the three games,
and in the final chapter so that your game will be ready to go.

A-Team
Who you have as part of your team can also impact the overall design and development of
your game. Having the right resources, skill set, and even personalities can have a large
influence on a game's success. Generally, a game development team consists of many
different people: artists, designers, animators, programmers, and sound designers. Each of
these roles will be sub-divided, for instance between character artists, texture artists, level
designers, AI programmers, gameplay programmers, and so on. However, having a range
of different skill sets allows for each part of the game's design to be developed in a
concentrated environment by someone who has experience in the relevant field. However,
not every game is lucky enough to feature an expansive team; you might even be reading
this book without knowing anyone from any of these fields, which is why this book is here
to guide you through the process and to support and expand your knowledge.

[ 13 ]
Press Start Chapter 1

There are many game developers that post information "behind the scenes" of
how their games are developed. These sometimes include commentary and
interviews with various members of their team. A lot of these videos touch on
the challenges that they face during the development of their game and in
some cases the heartache of not being able to complete certain features or the
game at all. I encourage you to check them out. There is one about the Making
of Assassin's Creed Unity you can watch by visiting this link or scanning the
QR code https:/​/​www.​youtube.​com/​watch?​v=​3OjVQBpQSEU:

Developing 2D games
There are some major and subtle differences between 2D and 3D game development, as
well as some misconceptions. Here, we'll go through the most common ones, and touch on
other relevant ones throughout the book. While you don't need a complete understanding
of these differences, the ones here are important to keep in mind if you're new to 2D game
development.

[ 14 ]
Press Start Chapter 1

X, Y, and Z-axis
The first obvious difference between 2D and 3D is that 2D utilizes only two axes: X and Y;
whereas 3D has an additional Z-axis. To explain how this works from a games perspective,
see the following diagram:

Generally speaking, the z-axis is used for depth and is utilized so that the player can
explore an environment like they would in reality whether it is from a third person or first-
person perspective camera. The z-axis allows the added third dimension to an environment.
2.5D games utilize the z-axis to provide a sense of depth because the game is still fixed to
the x and y-axes.

In saying that, it is important to know the differences between 2D, 2.5D, and 3D games.
While there are many different stories, quests, and adventures that games can take us on,
these experiences, at least in terms of their appearance and design, will differ depending on
what axis they are using—x, y, or z. Before we start creating any game in this book, we'll
just briefly go through some examples of 3D and various types of 2D style games. In this
way, you will learn about the differences between the two and what types of experiences
that they can afford.

Full 3D
These games are everything from Assassin's Creed (featured in the following screenshot to
Skyrim and everything in between. They are completely 3D immersive, explorable, and
interactable environments. When you think about the design of a 3D game, you need to
think about what the physical environment will look like. What kind of objects will be in it?
How does the player navigate around them and through the world? For example, think
about where you are right now.

[ 15 ]
Press Start Chapter 1

If you had to turn your current environment into one that would be in a video game, what
kinds of objects would you need to create? Perhaps a desk or chair, maybe a lamp? Then,
how would players interact with these objects? What kind of effects would occur, such as a
player turning the lamp on or off?

There are many basic and intricate details that go into making a 3D environment. Of course,
they are not exclusive to 3D environments, as we will see in the other types of games, but
these are some fundamental considerations.

Screenshot of Assassin's Creed

Orthographic (3D)
Just like the name suggests, orthographic 3D is a 3D game that is played from an
orthographic perspective. Sometimes, these are also referred to as Isometric games and are
given this name because of the perspective that they are played in. Some popular
orthographic games include Diablo, Q*bert, Clash of Clans, and Monument Valley (featured
next).

[ 16 ]
Press Start Chapter 1

Unlike 3D, and depending on the type of gameplay that is required (for example, can the
player rotate the environment?), the player will more than likely not see all sides of the
game environment.

Screenshot of Monument Valley

2D with 3D graphics, also known as 2.5D


Think of 2.5D simply as a 3D environment constrained to a 2D plane (for example, x, y-
axis). In other words, the player can only move up and down, left or right; they are not able
to move on the z-axis. The use of 3D is merely used mostly for an aesthetic purpose, such as
to show the depth of an environment. An example is shown next, with a screenshot taken
from the game New'n'Tasty. In this screenshot, you can see the characters are constricted to
a platform, with various levels (depths) of environmental assets visible in the background.
When designing for 2.5D games, only a portion of the environmental assets are seen, as if
you walked into a room and that is it, you can walk no further.

[ 17 ]
Press Start Chapter 1

There are different practices and approaches to modeling assets for games like this, so I
encourage you to explore them if 2.5D is something that piques your interest. Some other
great examples of 2.5D games are Little Big Planet, Trine, Bastion, and Raymond Origins.

Screenshot of New'n'Tasty

Full 2D
Games that are restricted to the x and y-axis (and don't show any depth) are what we call
2D games, such as Pac Man (featured next). They can be top-down or side-scrolling
(up/down/left/right). Unlike 3D games, players only see one side of the game object at any
given moment. Sometimes this can be quite linear in the sense that there is no perception of
depth (with the exclusion of parallax).

[ 18 ]
Press Start Chapter 1

Often though, sprites can be brought to life, as can the environment, with beautiful (frame-
by-frame) animations and effects. Other popular examples of 2D games are Mario, Donkey
Kong, Space Invaders, Monaco: What's Yours Is Mine, Mark of the Ninja, and Castlevania:
Symphony of the Night.

Screenshot of Pac Man

[ 19 ]
Press Start Chapter 1

2D with a perspective camera


Like 2.5D games, 2D games can also utilize "depth" by using a perspective camera or
utilizing a concept known as parallax, while not having any 3D assets within the
environment. To understand the concept of the parallax effect at a more scientific level, let
us look at the following diagram:

Depending on where you are, certain items are in view instead of others. If a player is at
viewpoint 1, then they will see the black circle and blue hexagon; if they are at viewpoint 2
then they will see the black circle and a red hexagon. Moreover, you can also think of it like
this as well, when you move within a game space, the "background" that is closest to you
moves faster than the "background" that is further away. It is the same when you're driving
in an area, such as the country, and you can see the mountains moving slower than the
fence. There are many games that use 2D with a perspective camera/parallax effect, such
as Braid (featured next).

[ 20 ]
Press Start Chapter 1

Other great examples of 2D games that feature parallax environments include Terraria and
Limbo.

The Unity Engine


You've made it, you've decided you want to learn Unity, good for you! There are a few
things that we need to do before we even open Unity (assuming you haven't downloaded it
or used it before). If you have already downloaded Unity and set it up, you can skip the
next section: An overview of built-in features in Unity; if you haven't please read on.

Downloading Unity
Now, let's start getting everything set up to create our games.

To begin, you can grab your own free copy of Unity by heading to the following
URL: https:/​/​unity3d.​com/​get-​unity/​download.

If you choose to download Unity 2018 Beta, it should not affect anything
that you will do in this book. However, it is possible that some things will
be slightly different than they are presented here. Please keep this in mind
when deciding on which version to download. For this book, we are going
to use the latest stable version at the time of writing.

[ 21 ]
Press Start Chapter 1

Each plan has its own benefits, some with more added features than others. Depending on
your long-term needs, a pro or plus plan might be useful. However, for all the projects in
this book, we will be using the personal (free) version of Unity. Once you have chosen the
version that suits your needs the most, download and install it.

While this book aims to teach you the basics of 2D game development, I
encourage you to check out these four things (all available on the official
website):

1. Tutorials https:/​/​unity3d.​com/​learn/​tutorials
2. Documentation https:/​/​docs.​unity3d.​com/​2017.​3/
Documentation/​Manual/​
3. Community https:/​/​unity3d.​com/​community
4. Social (for example, Twitter, Facebook groups, and so on)

Not only will you be able to explore a lot of the added 2D (and 3D) options
that Unity offers, which aren’t covered here, you can also learn about them
through their own tutorials. Lastly, I highly encourage you to become part
of the Unity Community and engage with their social media. In this way,
you will be able to connect with other Unity game developers while at the
same time being up to date with the latest news and be immersed in a
great platform for you to share your own projects and questions with
other game developers.

Once you have installed Unity, you will be required to log in. If you haven't created an
account, don't fret, it's a straightforward process. Simply click on the create one link to do it.
The process is simple, free, and will take little time to go through. Once you're done, come
back and enter your login details, and click Sign In.

More detailed information can be found here: https:/​/​unity3d.​com/


unity/​activation/​personal or by scanning the following QR code.

[ 22 ]
Press Start Chapter 1

Once you've done this, there will be a short survey about you (basic demographic
information) and your intended use of Unity. This is the final step before we will use Unity.
When you have submitted the survey response, you will see a screen with three different
options: Projects, Learn, and Activity, like this:

Projects simply show all your current projects that are either found on your computer (On
Disk) or online (In the Cloud). However, what I want to draw your attention to is the Learn
tab, which is shown here:

[ 23 ]
Press Start Chapter 1

There are several types of tutorials that you can explore at your own pace, like the ones in
this book, which will teach you some interesting things about Unity. You will need to
download each tutorial to go through it and depending on your connection, it may take a
little to no time. Here is an example of the Survival shooter tutorial, along with the
instructions within the browser (left):

(left) The Survival Shooter tutorial that Unity offers. (right) The tutorial as viewed within Unity itself.

An overview of built-in features in Unity


Unity has some great built-in features. Let's begin by exploring some of the basics. Unity
has many fantastic features, and we don't have enough time to cover them all. However, as
we venture further into this book we will start to cover the fundamental and important
ones. As you progress through the projects, we will begin to cover more advanced features.

[ 24 ]
Press Start Chapter 1

Creating a new 2D project in Unity


To begin a new project within Unity, we first need set up the project files. When you open
Unity, be sure to click on the New icon in the top navigation menu, on the right. Once you
have done this, you will see a screen like this:

Do these things first:

Give your project a unique name, something that isn't too long, but also
descriptive enough.
Next, in this window, we need to specify a location for your project that has
enough space available and isn't going to be modified by other people (other than
team members). This is more the case when it comes to shared workspaces and
networks.
Once you have done that, click on the radio button for 2D as shown in the
preceding screenshot.
Now, click Create Project. We don't need to add any asset packages at this stage
as we will be adding them manually later for each project.

Once you have done this, unity will open the project space, which we will discuss in more
detail in the next section.

[ 25 ]
Press Start Chapter 1

A brief overview of the Unity User Interface (UI)


Unity will begin setting up the project and once it's completed, you will see a screen like
this:

This is an example of the Unity UI once you open Unity. As you can see there are no project files at this stage.

This might be a bit overwhelming if you're new to Unity, but don't worry, you will be up to
speed in no time. We'll go through each part of it in more detail later in this chapter and
throughout the book, starting in the top left corner with Hierarchy, Scene,
Game, Inspector, Console, and finishing in the bottom left corner, with the Project panel.

[ 26 ]
Press Start Chapter 1

The main components of the UI in Unity


These are the main "default" components that you will see. By default, this means they are
here once you launch Unity for the first time or when you reset the workspace; we'll discuss
how to do this later.

Hierarchy Window
The Hierarchy Window contains all of the GameObject within the current Scene. A
GameObject can be anything from a prop or character to the scenery. In essence,
GameObjects are like a container that we can place things into what we refer to Component.
In Unity, Component can be for lighting, animation, character control, rendering, physics,
colliders, and so on. It is these that give GameObject functionality. An example of the
default Hierarchy window is this:

To put it simply, GameObject contain Component, which provides the functionality for
GameObject within a Scene. As we begin to add and remove GameObject from the Scene,
they will appear and disappear from the Hierarchy window as well. In addition, another
handy thing to know is that anything within the Hierarchy window can be parented.
Parenting simply establishes a hierarchy when it comes to the connection between
GameObject. For example, a 3D asset may contain various parts that need to be moved and
scaled together.

[ 27 ]
Press Start Chapter 1

Therefore, the main GameObject becomes a Parent and all the other objects become
Children. You can easily parent and unparent GameObject by simply selecting the main
object and dragging it to where you want it to sit within the hierarchical structure. You can
see this process illustrated here:

Lastly, it is possible to have more than one Scene opened in the Hierarchy window, but we
won't need to do this in the projects in the book. If you would like to know more about it,
head on over to the official Unity documentation by going to this link or scanning the QR
code: https:/​/​docs.​unity3d.​com/​Manual/​MultiSceneEditing.​html

Next, we will look at the "big picture" or the Scene View within Unity.

[ 28 ]
Press Start Chapter 1

Scene View
The Scene View is where all the magic happens. In here is where you will create your
game. You can see this part of the Unity UI, in the following screenshot. This is an
interactive space where you can select, rearrange, and position all the GameObject within
your project. We will cover Scene View navigation and how to move GameObject around
in the next chapters.

[ 29 ]
Press Start Chapter 1

Game View
The Game View is very similar to the Scene View, giving a window into your game. In
particular, the Game View shows which is the final result, what the player will see in your
game. Also, the Game View can simulate different screen ratios. This allows you to control
how your game will look on the different screens on which your game will run. Although
this is a good preview, before a final release, you should still test on as many as real screens
possible to ensure the best quality of your game. This is how it looks in Unity:

Inspector window
The Inspector window is where all the information related to the selected GameObject is
presented. It will become one of the most used windows within the Unity UI. As we have
already discussed, Scenes contain GameObject and these contain Component, and it is in
the Inspector window (like in the following screenshot) that all the information of this
Component is visible. This information relates to the properties and settings of not just
GameObject, but to pretty much everything else within Unity, such as assets, materials,
audio, and so on.

[ 30 ]
Press Start Chapter 1

We will go into more details about properties that are listed within the Inspector window
throughout the book, but for now, this is just an overview of what it does.

To get an idea of how it looks like when an object is selected here is an example of the
Inspector when the default camera is selected:

[ 31 ]
Press Start Chapter 1

Console window
The Console window, which is shown next, shows errors, warnings, and other messages
either generated by Unity or your own game code that relate to various parts of the project.
These messages can be simple syntax errors within code or more problematic issues relating
to performance. We will go into more detail about the different types of errors, how to
resolve common ones, and how to run checks known as Debugging—to check where errors
are occurring, in later chapters.

You will notice these errors as you play a Scene or try to run scripts. Each error will present
itself with a name and a brief description of what the error is, and where it can be found
within the script (for example, line number within a code file). Here is an example of a
simple log:

[ 32 ]
Press Start Chapter 1

Project Window
The Project window will display every file within your project that you have either
imported or created within Unity, such as models, scripts, plugins, and so on. Everything
within your Unity project is (and should be) contained within a folder structure, with the
Assets folder being the root—or parent folder, like in the following screenshot:

When you select a folder within the Project window the contents will be shown in the panel
to the right, like in this screenshot:

In this image, you can see the various Sprites that have been cut from the Sprite Sheet for Angel Cakes.

Customizing the workspace


It is quite easy to customize the layout of the workspace within Unity. There are many
different panels which serve different purposes: the Window menu item in the top bar can
be navigated to open additional panels or panels that have been closed earlier. To change
the layout, move the mouse cursor over the panel's name you want to move and then press
and hold the left mouse button. Holding down, drag the tab where you would like it to be.
It can be a floating (for example, separate window, see the following screenshot) or
anchored to another part of the Unity UI.

[ 33 ]
Press Start Chapter 1

You can see the difference between floating (image on the left) and anchored next to the
Hierarchy tab (image on the right) of the Project panel:

[ 34 ]
Press Start Chapter 1

If you have rearranged the workspace and don't like it, you can reset to Unity's default
layout. To do this, go to Window | Layouts | Revert Factory Settings..., as here:

You will be prompted with a confirmation box, as shown here, click Continue and the
layout will be reset.

From the same menu, It is also possible to save and load custom layouts. By doing this, you
can switch between your favorites layouts when you need to work on different aspects of
your game.

[ 35 ]
Press Start Chapter 1

Hotkeys to keep in mind


We all like to take shortcuts from time to time, and working with Unity, hotkeys can help
make performing simple tasks a whole lot more efficient. Here is a list of useful hotkeys for
actions that you'll perform on a regular basis throughout this book. Feel free to make a copy
of this page or print it to reference later (the list has been taken from the official
documentation of Unity at the following link: https:/​/​docs.​unity3d.​com/​Manual/
UnityHotkeys.​html). Here are the most used ones:

Tools
Keystroke Command
Q Pan
W Move
E Rotate
R Scale
T Rect Tool
Z Pivot Mode toggle
X Pivot Rotation Toggle
V Vertex Snap
Ctrl/command + LMB Snap
GameObject
Ctrl/command + Shift + N New empty game object
Alt + Shift + N New empty child to selected game object
Ctrl/command + Alt + F Move to view
Ctrl/command + Shift + F Align with view
Shift + F or double-F Locks the scene view camera to the selected GameObject

[ 36 ]
Another Random Scribd Document
with Unrelated Content
Transcriber’s Notes

Copyright notice provided as in the original—this e-text


is public domain in the country of publication.
Silently corrected palpable typos; left non-standard
spellings and dialect unchanged
Retained the original’s inconsistent italicization of
Spanish words.
In the text versions, delimited italics text in
_underscores_ (the HTML version reproduces the font
form of the printed book.)
This eBook, following the printed version, inconsistently
italicizes Spanish words.
*** END OF THE PROJECT GUTENBERG EBOOK BOY SCOUT
EXPLORERS AT EMERALD VALLEY ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in
the United States and most other parts of the world
at no cost and with almost no restrictions
whatsoever. You may copy it, give it away or re-use
it under the terms of the Project Gutenberg License
included with this eBook or online at
www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of
the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.
1.E.5. Do not copy, display, perform, distribute or redistribute this
electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you


derive from the use of Project Gutenberg™ works
calculated using the method you already use to
calculate your applicable taxes. The fee is owed to the
owner of the Project Gutenberg™ trademark, but he has
agreed to donate royalties under this paragraph to the
Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each
date on which you prepare (or are legally required to
prepare) your periodic tax returns. Royalty payments
should be clearly marked as such and sent to the
Project Gutenberg Literary Archive Foundation at the
address specified in Section 4, “Information about
donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user


who notifies you in writing (or by e-mail) within 30 days
of receipt that s/he does not agree to the terms of the
full Project Gutenberg™ License. You must require such
a user to return or destroy all copies of the works
possessed in a physical medium and discontinue all use
of and all access to other copies of Project Gutenberg™
works.

• You provide, in accordance with paragraph 1.F.3, a full


refund of any money paid for a work or a replacement
copy, if a defect in the electronic work is discovered and
reported to you within 90 days of receipt of the work.

• You comply with all other terms of this agreement for


free distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.
1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.
Volunteers and financial support to provide volunteers with the
assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.

Project Gutenberg™ eBooks are often created from several printed


editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookball.com

You might also like