Unity 3D Game Development By Example


What is Unity 3D?

Unity 3D is a game engine that’s been around for only a few years, but is rapidly gaining steam. It’s a tool that enables you to create your own 3D (or, with effort, 2D) games. You can deploy your games to the browser. That’s right: after a quick ~3MB plugin download, people can play your full 3D game right inside the browser, without having to download and install an .exe. If you want people to visit your portfolio site and play your games instantly, Unity 3D is the tool for you.

Can I Only Deploy to the Web?

No – the main Unity engine allows you to create standalone game files that will run on PC and Mac. If you purchase additional licenses, you can target the iPhone/iPod/iPad and WiiWare. Upcoming support has been announced for Android and Xbox Live Arcade (but keep in mind that you’ll still have to be a developer in good standing with Nintendo or Microsoft to develop for their consoles – it’s not a path you’ll likely take if you’re a hobbyist.)

How Much Does Unity Cost?

There are two versions of the core engine. Unity is free, while Unity Pro costs. Unity lacks a few features of Unity Pro, most notably real-time shadows and video playback support. (note: this lack of features is definitely not something that would get a beginner in much of a twist.) Games created with Unity are prefaced with a Unity-branded splash screen. You can check out a Unity license comparison grid here.

Beyond those restrictions, you’re free to make as many games as you like with the free version of Unity without paying a single cent to the engine authors. This is in contrast to UDK (Unreal Development Kit), Unity’s main competitor, which starts clawing back cash at (comparitively) alarming rates if you sell a certain number of copies.

I like Flash. Will I Like Unity?

Oh, yes! There are many similarities between the two programs. The biggest difference is that Flash is a content creation tool that people manhandle to the point where you can make games with it, while Unity 3D is a dedicated game engine. That means that it includes a lot of game systems right out of the box: physics, collision detection, 3D rendering and particle systems, to name a few.

Check out our Five Common AS3 to UnityScript Translations article in our Unity Nuub section.

What’s in the Book?

Unity 3D Game Development by Example contains lessons, code and art assets to build four very simple games in the engine: a keep-up game, a catch game, a memory game and a space shooter. These lessons are written in very plain language with lots of analogies and plenty of pictures, so that readers who have never coded or used a game engine in their lives will be able to get these projects off the ground. Certain elements, like the three countdown clocks in Chapter 7, are presented as standalone pieces that you can integrate into your games as you like. The book teaches you how to build standard game bits – title screens, buttons, timers, collision scripts, sound effects triggers, and endgame scenarios – that you can remix into your own projects.

Is This Book Appropriate to Use as a Text Book for my College or High School Game Design Program?

Absolutely. Please contact Packt Publishing for volume sales.

Is It Available As an e-Book?


I Enjoy Murdering Trees. Is It Available as a Book Book?


What Language is the Book Written In?

English, currently. All code examples are in javascript. Unity supports three different languages: javascript, C# and BOO. i chose javascript for the book because most of the online examples and tutorials i’ve come across are in javascript. It’s probably the best choice for a beginner.

What’s the Difference Between This Book and Unity Game Development Essentials by Will Goldstone?

Will’s also written a great beginner book – the first Unity 3D book on the market – that you should definitely check out. Will’s book contains one large open-world project with a number of smaller activities inside of it. My feeling was that open-world games open a whole can of worms that could potentially overwhelm someone new to Unity (what happens when you walk out into the water? What if you get stuck inside a volcano?). My focus was on keeping things simple and manageable, so that you can start with a very controlled and fully-functional project, and ramp up from there as your skills increase.

What’s the Difference Between This Book and an Riding Down an Exhilharating Waterslide on the Back of a Unicorn?

Not much.

Preface and Chapter Listing

By request, here is an excerpt from the book’s Preface:

“Game Developer” has rapidly replaced “firetruck” as the number one thing that kids want to be when they grow up. Gone are the days when aspiring developers needed a university education, a stack of punch cards, and a room-sized computer to program a simple game. With digital distribution and the availability of inexpensive (or free) games development tools like Unity 3D, the democratization of game development is well underway.

But, just as becoming a firetruck is fraught with perils, so too is game development. Too often, aspiring developers underestimate the sheer enormity of the multidisciplinary task ahead of them. They bite off far more than they can chew, and eventually drift away from their game development dreams to become lawyers or dental hygienists. It’s tragic. This book bridges the gap between “I wanna make games!” and “I just made a bunch of games!” by focusing on small, simple projects that you can complete before you reach the bottom of a bag of corn chips.

What this book covers

Chapter 1, That’s One Fancy Hammer!, introduces you to Unity 3D—an amazing game engine that enables you to create games and deploy them to a number of different devices, including (at the time of writing) the Web, PCs, iOS platforms, and WiiWare, with modules for Android and Xbox Live Arcade deployment in the works. You’ll play a number of browser-based Unity 3D games to get a sense of what the engine can handle, from a massively-multiplayer online game all the way down to a simple kart racer. You’ll download and install your own copy of Unity 3D, and mess around with the beautiful Island Demo that ships with the product.

Chapter 2, Let’s Start with the Sky, explores the difference between a game’s skin and its mechanic. Using examples from video game history, including Worms, Mario Tennis, and Scorched Earth, we’ll uncover the small, singular piece of joy upon which more complicated and impressive games are based. By concentrating on the building blocks of video games, we’ll learn how to distil an unwieldy behemoth of a game concept down to a manageable starter project.

Chapter 3, Ticker Taker, puts you in the pilot seat of your first Unity 3D game project. We’ll explore the Unity environment and learn how to create and place primitives, add Components like physic materials and rigidbodies, and make a ball bounce on a paddle using Unity’s built-in physics engine without ever breaking a sweat.

Chapter 4, Code Comfort, continues the keep-up game project by gently introducing scripting. Just by writing a few simple, thoroughly-explained lines of code, you can make the paddle follow the mouse around the screen to add some interactivity to the game. This chapter includes a crash course in game scripting that will renew your excitement for programming where high school computer classes may have failed you.

Chapter 5, Game#2: Robot Repair, introduces an often-overlooked aspect of game development: “front-of-house” User Interface design—the buttons, logos, screens, dials, bars, and sliders that sit in front of your game—is a complete discipline unto itself. Unity 3D includes a very meaty Graphical User Interface system that allows you to create controls and fiddly bits to usher your players through your game. We’ll explore this system, and start building a complete two-dimensional game with it! By the end of this chapter, you’ll be halfway to completing Robot Repair, a colorful matching game with a twist.

Chapter 6, Game#2: Robot Repair Part 2, picks up where the last chapter left off. We’ll add interactivity to our GUI-based game, and add important tools to our game development tool belt, including drawing random numbers and limiting player control. When you’re finished with this chapter, you’ll have a completely playable game using only the Unity GUI system, and you’ll have enough initial knowledge to explore the system yourself to create new control schemes for your games.

Chapter 7, Don’t be a Clock Blocker, is a standalone chapter that shows you how to build three different game clocks: a number-based clock, a depleting bar clock, and a cool pie wedge clock, all of which use the same underlying code. You can then add one of these clocks to any of the game projects in this book, or reuse the code in a game of your own.

Chapter 8, Ticker Taker, revisits the keep-up game from earlier chapters and replaces the simple primitives with 3D models. You’ll learn how to create materials and apply them to models that you import from external art packages. You’ll also learn how to detect collisions between Game Objects, and how to print score results to the screen. By the end of this chapter, you’ll be well on your way to building Ticker Taker—a game where you bounce a still-beating human heart on a hospital dinner tray in a mad dash for the transplant ward!

Chapter 9, Game#3: The Break-Up is a wild ride through Unity’s built-in particle system that enables you to create effects like smoke, fire, water, explosions, and magic. We’ll learn how to add sparks and explosions to a 3D bomb model, and how to use scripting to play and stop animations on a 3D character. You’ll need to know this stuff to complete The Break-Up—a catch game that has you grabbing falling beer steins and dodging explosives tossed out the window by your jilted girlfriend.

Chapter 10, Game#3: The Break-Up Part 2, completes The Break-Up game from the previous chapter. You’ll learn how to reuse scripts on multiple different Game Objects, and how to build Prefabs, which enable you to modify a whole army of objects with a single click. You’ll also learn to add sound effects to your games for a much more engaging experience.

Chapter 11, Game #4: Shoot the Moon, fulfills the promise of Chapter 2 by taking you through a re-skin exercise on The Break-Up. By swapping out a few models, changing the background, and adding a shooting mechanic, you’ll turn a game about catching beer steins on terra firma into an action-packed space shooter! In this chapter, you’ll learn how to set up a two-camera composite shot, how to use code to animate Game Objects, and how to re-jig your code to save time and effort.

Chapter 12, Action, takes you triumphantly back to Ticker Taker for the coup de grace: a bouncing camera rig built with Unity’s built-in animation system that flies through a model of a hospital interior. By using the two-camera composite from The Break-Up, you’ll create the illusion that the player is actually running through the hospital bouncing a heart on a tin tray. The chapter ends with a refresher on bundling your project and deploying it to the Web so that your millions of adoring fans can finally experience your masterpiece.

What you need for this book

You’ll need to be in possession of a sturdy hat, a desk chair equipped with a seatbelt, and an array of delicious snack foods that won’t get these pages all cheesy (if you’re reading the e-book version, you’re all set). Early chapters walk you through downloading and installing Unity 3D (http://unity3d.com/unity/download/). A list of resources and links to additional software can be found in the appendix.

Who this book is for

If you’ve ever wanted to develop games, but have never felt “smart” enough to deal with complex programming, this book is for you. It’s also a great kickstart for developers coming from other tools like Flash, Unreal Engine, and Game Maker Pro.

What’s Next?

Got any more questions? Drop me a line in the comments section and i’ll answer them here. Meanwhile, order Unity 3D Game Development by Example!

3 thoughts on “Unity 3D Game Development By Example

  1. Pingback: Unity 3D Game Development by Example Fulfills MY Dreams (at the very least) —Infinite Unity3D Infinite Unity

  2. Pingback: untoldentertainment.com » How to Start a Game Project in Unity

  3. Pingback: Traditional vs. Social, A Hilarious Must Read « nick breslin . game developer

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.