Jump to ratings and reviews
Rate this book

Learning Unity 2D Game Development by Example

Rate this book
Create your own line of successful 2D games with Unity! If you are interested in creating your very own 2D games from scratch, then this book will give you all the tools you need to succeed. Whether you are completely new to Unity or have used Unity before and would like to learn about the new 2D features of Unity, this book is for you. 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. 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 with collision, parallax scrolling, Box2D, and more. 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.

266 pages, Paperback

First published January 1, 2014

6 people are currently reading
44 people want to read

About the author

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
5 (33%)
4 stars
3 (20%)
3 stars
5 (33%)
2 stars
2 (13%)
1 star
0 (0%)
Displaying 1 - 4 of 4 reviews
Profile Image for Heleen Durston.
20 reviews
September 26, 2014
I really enjoy working with the Unity game engine. It is terrific as a 3D engine; but recently they have added 2D functionalities. “Learning Unity 2D Game Development by Example” by Venita Pereira is a book that will help you understand how to use the new 2D aspects of Unity 2D. As with most Packtpub books the artwork, code samples, etc. are available on their website for download.
The book begins with providing information on where to download Unity 3D version 4.3.4. I completed the projects in the book with the current beta version (Unity 4.6) and everything worked just fine. Next you create a project and then the book discusses the interface with you including how to bring up the Animator and Animation components which you will need for some of the later projects in the book.
The next chapter discusses how to create a scene in Unity. It presents how to import sprites (graphics) and place them in a scene and then how to create a prefab from the sprites. Camera settings, setting a background and working with a grid are all explained. Chapter 3 is covers creating a 2D character in your scene. Unity’s animation system, Mecanim, is explained. How to import a sprite sheet; chop it into the various sprites which represent body parts, and then animate the resulting character is explained.
Chapter 4 discusses programming a game using UnityScript, which is Unity’s version of JavaScript. Example code is given for controlling a 2D character, printing output to your computer screen and destroying an enemy. Chapter 5 is all about giving your game information (input), and how to use Unity’s Input Manager.
The next four chapters go into detail on how to create 4 different sorts of 2D games. The games types are: roguelike, classic arcade, endless runner and a physics game. A website location is listed where you can download the graphics for all the projects listed. The roguelike game chapter explains how to break up a spritesheet into its various sprites and then how to animate them. Randomly spawning enemies, programming your character to shoot an object and destroying objects are all part of this lesson.
The classic arcade game demonstrated is the one where you move your character along the bottom of the screen and random objects spawn from the top and drop down for you to try and catch. The chapter explains 3 common game mechanics: keeping score, a timer, and how to give your character more than one life. The chapter goes on to explain how display all of these on a HUD screen.
The endless runner chapter mostly discusses how to make a ninja character appear to be running endlessly. This is done by explaining how to create parallax scrolling in Unity. The chapter also explains how to use Unity’s particle effects to create puffs of dirt coming off the ninja as he is running.
The physics game chapter explains how to create a game using the Box2D physics engine that Unity provides. The example game provided involves shooting a cannon and having it knockdown planks on top of boxes. Scripts to do this are explained and how to extend the game is discussed.
The last chapter describes how to polish all the example games by adding audio, more cameras, multiplayer, and the ability to save and load. Then details are provided on how to deploy the game to the web. The book ends with a list of online resources where you can find more information on Unity.
Overall, I liked the book and enjoyed learning the ins-an-outs of programming and implementing the various sample game types. If you are new to Unity and especially if you are new to Unity 2D then I can easily recommend this book. Here is the link for the book http://bit.ly/VRS4CF
1 review
November 15, 2014
If you want to start game development and/or you want to start the Unity2D engine without a lot of development experience (which may not be an obvious choice if you are new to development), then this book is for you. This book is indeed really for beginners.
It assumes that you don’t know much about Unity, but also about game development (for example it will go over explanations of what a spritesheet or a background is),or even coding (there is a whole chapter devoted to the fundamentals of programming ... ).The first part of the book is rather theoric.
After going over Unity2D’s panels and concepts (camera, prefabs, sprite animation, etc), and an introduction to coding, it becomes really practical showing you how to use all this to build small specific games (roguelike, infinite runner, basic platform) . Step by step it goes along on how to create your game elements (player, enemies, etc) in Unity, and code the game logic. What is great is that you get here a lot of information, enough to be able to develop a lot of games for yourself that you might have in mind. There is also a small introduction to physics and Box2D.
Finally there is a chapter about deployment (a bit too fast in my opinion, I don’t think that if never used Unity you understand what it is about) , and extra things you might need to improve and optimize your games
You learn a lot about Unity with this book for sure and how to start making 2D games with it . The examples are really good, and cover a lot of aspects fundamental to 2D small games. What it doesn’t speak about however, is how to design your game as a multi-platform games (mobile, desktop,etc), which is by far one of the strongest point of Unity. There are few hints here and there, but the subject is not really covered. It could have gone further also about deployment, and what it involves depending on targeted platforms.
If you are a real beginner I think you will get a lot of informations on the 2D game dev process, and Unity, with a really practical approach. I have a mixed feeling about the ‘code control’ chapter. I am not sure that if you have no prior experience with coding, as it seems to presuppose, you will grasp that part and if you know how to code, you’ll just skip it. I would have preferred more advice about mobile development and resolution strategies instead.
If you are already a developer with 2D game development experience but want to learn how to develop with Unity, all the chapters and parts about Unity itself and the examples will be very useful and it is a very good introduction to Unity2D (and you will just skip the other parts).
Profile Image for Marc-anthony Taylor.
8 reviews
October 8, 2014
This book really is for beginners though so if you have a wee bit of background in Unity this might not be the book for you. I, however, had no idea how to use Unity. (In fact I really dislike using GUIs to build things, mainly because I am crap at it I have absolutely no visual competence when it comes to making things look good.) So this was the perfect book for me.

The first five chapters lead us through the very basics:
- Introduction to the UI
- Creation and manipulation of sprites and objects
- The programming fundamentals required

The pace isn't so slow that you might grow bored nor so fast that you need go back because you missed something.
The next set of four chapters allow us to work through some examples in the form of mini-games:

- Rogue Like - a tiny randomly generated roguelike funnily enough
- Spongy Antics - a fun wee game with a classic arcade aspect
- Agile Ninja - an endless runner
- Physics Fun - a physics sandbox

These are fun to build and it was great to let my three year old have a go at them. The physics part was a good introduction to physics in games and I think I might have preferred to tackle that first. I had the most trouble with the endless runner, no matter what I do I can't animate the background properly. (I told you I suck at visuals!) The only criticism I have is that the explanation of the code was at times repetitive, this was why the code took up so much space. Maybe it's just because I am already familiar with coding but it seemed a little jarring to me.

The final chapter has another mini-project, this one a platformer with 2 levels. The concepts found throughout the book are all implemented here but we are also introduced to several new ones: networking is touched upon even if only to explain that it is out of the scope of the book; working with media such as sound is dealt with as you apply effects; saving and loading a player's progress; moving cameras; and even deployment. The book ends with a great list of resources on where to go from there.

The most important thing for me when reviewing a book is "did I learn from it?" and I really did. Not only that but it was a fun read. If I could wish for something it might be a little more time spent on object attributes especially near the beginning. If that and the aforementioned repetitive parts are my only complaint then there isn't much wrong with it. Highly recommended.
Profile Image for Mariano Alavrez.
2 reviews
November 18, 2014
Is a very beginner book, the first 4 chapters are bored for someone that as a background in programming. From chapter 6 begins the real examples, but are so easy. it take at most one hour to complete each example. Although are good examples to practice the skill, and learn some things.

The book lacks much on scripting, 2D Animation, GUI, etc... Enter to a intermediate level of development a game with Unity. Exists best content on the official page of unity.
Displaying 1 - 4 of 4 reviews

Can't find what you're looking for?

Get help and learn more about the design.