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

Resource management


When developing games, it is vital that we are wise at resource management and reuse the resources available to us. We should not waste resources since devices do not have an infinite amount of resources available.

Thus, by wasting resources, we are increasing the overhead on the device's memory and processor, impacting performance. For instance, if we keep creating many new objects in a scene, there is a huge amount of information to store, calculate, and handle. This will slow down the game and could potentially crash the game due to it running out of memory or an overload of calculations.

It is therefore best practice to reuse or destroy (remove) objects once they are no longer needed, particularly when they are no longer on screen.

Garbage collection is a type of memory management whereby the garbage collector tries to reclaim memory that is no longer being used by the game. Unity performs garbage collection automatically; however, based on the game's design, we need...