Book Image

Learning Unity 2D Game Development by Example

By : Venita Pereira
Book Image

Learning Unity 2D Game Development by Example

By: Venita Pereira

Overview of this book

<p>If you are looking for a guide to create 2D games using Unity, look no further. With this book, you will learn all the essentials of 2D game development by creating five real-world games in a step-by-step manner throughout the course of this book.</p> <p>Starting with a blank scene, you will learn all about the new Unity 2D toolset, which will enable you to bring your scene to life. You will create characters, make them move, create some enemies, and then write code to destroy them. After figuring out all the necessities of creating a game, this book will then assist you in making several different games: games with collision, parallax scrolling, Box2D, and more.</p> <p>By the end of this book, you will not only have created several small games, but you will also have the opportunity to put all your new-found knowledge into creating and deploying a larger, full game.</p>
Table of Contents (17 chapters)
Learning Unity 2D Game Development by Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The resulting environment


With the new 2D features of Unity, the 2D camera is already set. This makes it easier to set up our scene as we need only worry about positioning the background and foreground elements and layering them.

Camera settings

We will go through the camera settings to understand them. When we click on the Main Camera option in our scene, we get the following settings within the Inspector tab as shown in the following screenshot:

The following are the parameters of the Main Camera option:

  • Clear Flags: This sets which parts of the screen are to be cleared.

  • Background: This selects which color to display behind all the objects in our scene if we have not added a skybox, background, or image that takes up the whole screen.

  • Culling Mask: This selects which layers are to be rendered by the camera.

  • Projection: We select Perspective if we want to work in 3D and Orthographic to set our camera mode to 2D.

  • Size: This is the size of the camera in Orthographic (2D) mode.

  • Clipping Planes...