Unity 3D Game Development by Example Beginner's Guide

There is a newer version of this book available - Unity 3.x Game Development by Example Beginner's Guide
Unity 3D Game Development by Example Beginner's Guide
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
save 44%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Build fun games using the free Unity 3D game engine even if you've never coded before
  • Learn how to "skin" projects to make totally different games from the same file – more games, less effort!
  • Deploy your games to the Internet so that your friends and family can play them
  • Packed with ideas, inspiration, and advice for your own game design and development
  • Stay engaged with fresh, fun writing that keeps you awake as you learn

Book Details

Language : English
Paperback : 384 pages [ 235mm x 191mm ]
Release Date : September 2010
ISBN : 1849690545
ISBN 13 : 9781849690546
Author(s) : Ryan Henson Creighton
Topics and Technologies : All Books, Game Development, Unity, Beginner's Guides, Games

Table of Contents

Chapter 1: That's One Fancy Hammer!
Chapter 2: Let's Start with the Sky
Chapter 3: Game #1: Ticker Taker
Chapter 4: Code Comfort
Chapter 5: Game #2: Robot Repair
Chapter 6: Game #2: Robot Repair Part 2
Chapter 7: Don't Be a Clock Blocker
Chapter 8: Ticker Taker
Chapter 9: Game #3: The Break-Up
Chapter 10: Game #3: The Break-Up Part 2
Chapter 11: Game #4: Shoot the Moon
Chapter 12: Action!
Appendix: References
  • Chapter 1: That's One Fancy Hammer!
    • Introducing Unity 3D
    • Unity takes over the world
    • Browser-based 3D? Welcome to the future
    • Time for action – install the Unity Web Player
    • Welcome to Unity 3D!
    • What can I build with Unity?
      • FusionFall
    • Completely hammered
    • Should we try to build FusionFall?
    • Another option
      • Off-Road Velociraptor Safari
        • Fewer features, more promise
        • Maybe we should build Off-Road Velociraptor Safari?
    • I bent my Wooglie
      • Big Fun Racing
      • Diceworks
    • Walk before you can run (or double jump)
    • There's no such thing as "finished"
    • Stop! Hammer time
      • Explore Demo island
    • The wonders of technology!
    • The Scene window
      • The Game window
      • The Hierarchy
      • The Project panel
      • The Inspector
      • Invade Island Demo as a paratrooper
      • Layers and layout dropdowns
      • Playback controls
      • Scene controls
    • Don't stop there—live a little!
    • Summary
      • Big ambition, tiny games
  • Chapter 2: Let's Start with the Sky
    • That little lightbulb
    • The siren song of 3D
    • Features versus content
    • A game with no features
    • Mechanic versus skin
    • Trapped in your own skin
    • That singular piece of joy
    • One percent inspiration
    • Motherload
    • Heads up!
    • Artillery Live!
    • Pong
    • The mechanic that launched a thousand games
    • Toy or story
    • Redefining the sky
    • Summary
      • Let's begin
  • Chapter 3: Game #1: Ticker Taker
    • Kick up a new Unity project
      • Where did everything go?
    • 'Tis volley
    • Keep the dream alive
    • Slash and burn!
    • The many faces of keep-up
    • Creating the ball and the hitter
    • Time for action – create the ball
    • A ball by any other name
    • Time for action – rename the ball
    • Origin story
      • XYZ/RGB
    • Time for action – move the ball into the "sky"
    • Time for action – shrink the ball
    • Time for action – save your Scene
    • Time for action – add the Paddle
      • What's a Mesh?
      • Poly wanna crack your game performance?
    • Keeping yourself in the dark
    • Time for action – add a light
    • Time for action – move and rotate the light
      • Extra credit
    • Are you a luminary?
      • Who turned out the lights?
      • Darkness reigns
    • Time for action – test your game
    • Let's get physical
    • Time for action – add physics to your game
    • Understanding the gravity of the situation
    • More bounce to the ounce
    • Time for action – make the ball bouncy
    • Summary
      • Following the script
  • Chapter 4: Code Comfort
    • What is code?
    • Time for action – write your first Unity Script
    • A leap of faith
    • Lick it and stick it
      • Disappear Me!
    • It's all Greek to me
    • You'll never go hungry again
    • With great sandwich comes great responsibility
    • Examining the code
    • Time for action – find the Mesh Renderer component
    • Time for action – make the ball reappear
    • Ding!
    • Time for action – journey to the Unity Script Reference
    • The Renderer class
    • What's another word for "huh"?
    • It's been fun
    • Time for action – unstick the Script
    • Gone, but not forgotten
    • Why code?
    • Equip your baby bird
    • Time for action – create a new MouseFollow Script
    • A capital idea
    • Animating with code
    • Time for action – animate the Paddle
    • Pick a word—(almost) any word
    • Screen Coordinates versus World Coordinates
    • Move the Paddle
    • Worst. Game. Ever.
    • See the matrix
    • Time for action – animate the Paddle
    • A tiny bit o' math
    • Tracking the numbers
    • Futzing with the numbers
    • Time for action – log the new number
    • She's A-Work!
    • Somebody get me a bucket
    • Time for action – declare a variable to store the screen midpoint
    • Using all three dees
    • Time for action – follow the Y position of the mouse
    • A keep-up game for robots
    • Once more into the breach
    • Time for action – revisit the Unity Language Reference
    • Our work here is done
    • Time for action – add the sample code to your Script
    • One final tweak
      • What's a quaternion?
      • Wait, what's a quaternion?
    • Educated guesses
      • More on Slerp
    • Right on target
    • Keep it up
      • Beyond the game mechanic
  • Chapter 5: Game #2: Robot Repair
    • You'll totally flip
      • A blank slate
      • You're making a scene
    • Time for action – set up two Scenes
      • No right answer
    • Time for action – prepare the GUI
      • The beat of your own drum
    • Time for action – create and link a custom GUI skin
    • Time for action – create a button UI control
      • Want font?
      • Cover your assets
    • Time for action – nix the mipmapping
      • Front and center
    • Time for action – center the button
      • To the game!
    • Time for action – add both scenes to the build list
      • Set the stage for robots
    • Time for action – prepare the game Scene
      • The game plan
      • Have some class!
    • Time for action – store the essentials
      • Start me up
      • Going loopy
      • The anatomy of a loop
      • To nest is best
      • Seeing is believing
    • Time for action – create an area to store the grid
      • Build that grid
      • Now you're playing with power!
  • Chapter 6: Game #2: Robot Repair Part 2
    • From zero to game in one chapter
      • Finding your center
    • Time for action – center the game grid vertically
    • Time for action – center the game grid horizontally
    • Down to the nitty griddy
      • Do the random card shuffle
    • Time for action – prepare to build the deck
      • Let's break some robots
    • Time for action – build the deck
    • Time for action – modify the img argument
      • What exactly is "this"?
      • Random reigns supreme
      • Second dragon down
      • Time to totally flip
    • Time for action – make the cards two-sided
    • Time for action – build the card-flipping function
    • Time for action – build the card-flipping function
      • Pumpkin eater
      • Stabby McDragonpoker rides again
      • Game and match
    • Time for action – ID the cards
    • Time for action – compare the IDs
      • On to the final boss
      • Endgame
    • Time for action – check for victory
      • Endgame
      • Bring. It. On.
  • Chapter 7: Don't Be a Clock Blocker
    • Apply pressure
    • Time for action – prepare the clock script
    • Time for more action – prepare the clock text
    • Still time for action – change the clock text color
    • Time for action rides again – create a font texture and material
    • Time for action – what's with the tiny font?
    • Time for action – prepare the clock code
    • Time for action – create the countdown logic
    • Time for action – display the time on-screen
      • Picture it
    • Time for action – grab the picture clock graphics
    • Time for action – flex those GUI muscles
      • The incredible shrinking clock
      • Keep your fork—there's pie!
      • How they did it
    • Time for action – rig up the textures
    • Time for action – write the pie chart Script
    • Time for action – commence operation pie clock
    • Time for action – positioning and scaling the clock
    • Unfinished business
  • Chapter 8: Ticker Taker
    • Welcome to Snoozeville
      • Model behavior
    • Time for action – explore the models
    • Time for action – hands up!
    • Time for action – change the FBX import scale settings
    • Time for action – make the Mesh Colliders convex
    • Time for action – make the Hands and Tray follow the Mouse
    • Time for action – get your heart on
    • Time for action – ditch the Ball and Paddle
    • Time for action – material witness
    • This Just In: This Game Blows
    • Time for action – multiple erections
    • Time for action – create a font texture
    • Time for action – create the HeartBounce Script
    • Time for action – tag the tray
    • Time for action – tweak the bounce
    • Time for action – keeping track of the bounces
    • Time for action – add the lose condition
    • Time for action – add the Play Again button
      • Ticker Taken
  • Chapter 9: Game #3: The Break-Up
    • Time for action – bombs away!
    • Time for action – poke those particles
    • Time for action – create a Spark Material
    • Time for action – prefabulous
    • Time for action – lights, camera, apartment
    • Time for action – add the character
    • Time for action – register the animations
    • Time for action – script the character
    • Time for action – open the Pod Bay Door, Hal
    • Time for action – collision-enable the Character
    • Time for action – re-Prefab the Prefab
    • Time for action – apocalypse now?
    • Time for action – go boom
    • Time for action – the point of impact
    • Time for action – hook up the explosion
    • Summary
  • Chapter 10: Game #3: The Break-Up Part 2
    • Time for action – amass some glass
    • Time for action – create a Particle System
    • Time for action – make it edgier!
    • Time for action – contain the explosion
    • Time for action – let's get lazy
    • Very variable?
    • Terminal velocity is a myth—bombs fall faster
    • Time for action – tag the objects
    • Time for action – write the collision detection code
    • Time for action – animation interrupts
    • Time for action – add facial explosions
    • Time for action – make some noise
    • Time for action – add sounds to the FallingObjectScript
    • What's the catch?
    • Time for action – mix it up a bit
    • Summary
  • Chapter 11: Game #4: Shoot the Moon
    • Time for action – duplicate your game project
    • Time for action – space this sucker up a bit
    • Time for action – enter the hero
    • Time for action – it's a hit!
    • Time for action – bring on the bad guys
    • Time for action – do some housekeeping
    • Time for action – fixing the fall
    • Time for action – tweak the hero
    • Time for action – give up the func
    • Time for action – itchy trigger finger
    • Time for action – futurize the bullet
    • Time for action – building Halo
    • Time for action – fire!
    • Time for action – Code Do-Si-Do
    • Time for action – the maaagic of aaaarguments
    • Time for action – add the most important part of any space
    • shooter
      • Last year's model
    • Summary
    • More hospitality
  • Chapter 12: Action!
    • Open heart surgery
    • Time for action – haul in the hallway
    • Time for action – meet me at camera two
    • Time for action – adjust the Main Camera
    • Time for action – deck the halls
    • Time for action – turn on the lights
    • Time for action – set up the camera rig
    • Time for action – animate the bouncer
    • Time for action – I like to move it move it
    • Time for action – animate the runner
    • Time for action – how to "handle" Nurse Slipperfoot
    • Time for action – you spin me right round
    • Time for action – deploy your game
      • Time to grow
      • Beyond the book
  • Appendix: References
    • Online resources
    • Offline resources
    • Free development tools
      • Graphics
      • Sound
    • Content sites
    • Game Portals

Ryan Henson Creighton

Ryan is the founder of Untold Entertainment Inc., a boutique game development studio in the heart of downtown Toronto. Ryan got his start at a Canadian television broadcaster creating small, simple games for kids and preschoolers. By the time he was through, he had built over fifty games for a wide range of clients including McDonalds, Hasbro, Lego, Proctor and Gamble, Nickelodeon, and the Canadian National Institute for the Blind. These games ran the gamut from simple slider puzzles, memory games, and contest entry mechanics to tile-based graphic adventure games and massively multiplayer virtual worlds. Ryan often leveraged his theatre background to perform on-camera in promotional spots for Microsoft and Nintendo. He spent a number of years moonlighting as a video game journalist under the cartoonish moniker "MrSock".

Ryan founded Untold Entertainment Inc. in 2007 and has continued to develop great kids' content with broadcasters and independent television producers to help extend their on-air brands online. He packs the company's popular blog with tutorials, designer diaries, and insights into the world of independent game development, employing his signature biting wit and ludicrous photo captions.

Through Untold Entertainment, Ryan is developing a number of original properties, which include: Interrupting Cow Trivia, an online multiplayer trivia game; Spellirium, a word puzzle/adventure game hybrid; UGAGS, the Untold Graphic Adventure Game System; and Kahoots, a fun crime-themed puzzle game modeled entirely in clay.

Ryan lives and bikes around downtown Toronto with his wife Cheryl, and his two tiny daughters Cassandra and Isabel.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


- 11 submitted: last submission 03 Feb 2014

Errata type: Code | Page number: 139 | Errata date: 28 Sept 10

var cols:int = 4; // the number of columns in the card grid

var rows:int = 4; // the number of rows in the card grid

var totalCards:int = 16; // (cols times rows is 16)

var matchesNeededToWin:int = totalCards * 0.5; // If there are 16 cards, the player needs to find 8 matches to clear the board


Errata type: Others | Page number: 276, 277

In order to center and size the the capsule collider properly around the stein, use these settings:


X: 0

Y: 0.8

Z: 2

RADIUS : 1.5


Errata type: Code | Page number: 278


transform.position.y -= 50 * Time.deltaTime;


transform.position.y -= speed * Time.deltaTime;

Errata type: Code | Page number: 174 |

The following line (approximatly 1/2 way down the page) is missing a semi colon at the end

img = "blank"


Errata type: Code| Page number: 196 |

Near the top of the page 196 in '4.' the bolded code is missing an open bracket ( just after the Rect command.

It is:

GUI.BeginGroup (new Rect Screen.width - clockBG.width - gap, gap, clockBG.width, clockBG.height));

It should be:

GUI.BeginGroup (new Rect (Screen.width - clockBG.width - gap, gap, clockBG.width, clockBG.height));

Note, the code is fixed when listed in full on the next page.


Errata type: Typo| Page number: 24 |

On the last paragraph of the page it reads "The red X-axis runs perpendicular to the X-axis" it probably should read "The red X-axis runs perpendicular to the Z-axis".

Errata type: Layout| Page number: 272 | Errata date: 2 July 2011

The One Shot check box is in the Ellipsoid Particle Emitter section, not the Particle Animator section and should be listed on page 271.



Errata type: Code| Page number: 166| Errata date: 4 May 2011

TMidway down the page, non bold text reads: if(UILayout.Button(Resources.Load(img), When it needs to read if(GUILayout.Button(Resources.Load(img),

Errata type: Technical| Page number: 263| Errata date: 2 July 2011

Step 5 should be ignored. The Explosion Game Object should not be deleted because it is required for the following steps. The correct instruction to delete it is on page 266.

Errata type: code| Page number: 166| Errata date: 23 Sept 2011

The error is in the function BuildGrid(). The 1st and 19th line within the function (including curly braces) should have GUILayout instead of UILayout.

Errata type: code |  Page number: 172

It is: card= new Card("robot" + (i+1) + theMissingPart,id);

It should be: card= new Card("robot" + (i+1) + theMissingPart,id);

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Unity 3D Game Development by Example Beginner's Guide +    Adobe Flash 11 Stage3D (Molehill) Game Programming Beginner’s Guide =
50% Off
the second eBook
Price for both: £21.80

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Find out how people are using the amazing new Unity 3D game engine
  • Develop and customize four fun game projects, including a frantic race through hospital hallways with a still-beating human heart and a catch game with a jilted lover that morphs into a space shooter!
  • Create both 2D and 3D games using free software and supplied artwork
  • Add motion, gravity, collisions, and animation to your game objects using Unity 3D's built-in systems
  • Learn how to use code to control your game objects
  • Create particle systems like shattering glass, sparks, and explosions
  • Add sound effects to make your games more exciting
  • Create static and animated backdrops using multiple cameras
  • Build crucial elements you'll use again and again, like timers, status bars, title screens, win/lose conditions, and buttons to link game screens together
  • Deploy your games to the Web to share them with friends, family, and adoring fans
  • Discover the difference between game skins and mechanics, to earn more money from your games


In Detail

Beginner game developers are wonderfully optimistic, passionate, and ambitious. But that ambition is often dangerous! Too often, budding indie developers and hobbyists bite off more than they can chew. Some of the most popular games in recent memory – Doodle Jump, Paper Toss, and Canabalt, to name a few – have been fun, simple games that have delighted players and delivered big profits to their creators. This is the perfect climate for new game developers to succeed by creating simple games with Unity 3D, starting today.

This book starts you off on the right foot, emphasizing small, simple game ideas and playable projects that you can actually finish. The complexity of the games increases gradually as we progress through the chapters. The chosen examples help you learn a wide variety of game development techniques. With this understanding of Unity 3D and bite-sized bits of programming, you can make your own mark on the game industry by finishing fun, simple games.

This book shows you how to build crucial game elements that you can reuse and re-skin in many different games, using the phenomenal (and free!) Unity 3D game engine. It initiates you into indie game culture by teaching you how to make your own small, simple games using Unity3D and some gentle, easy-to-understand code. It will help you turn a rudimentary keep-up game into a madcap race through hospital hallways to rush a still-beating heart to the transplant ward, program a complete 2D game using Unity's User Interface controls, put a dramatic love story spin on a simple catch game, and turn that around into a classic space shooter with spectacular explosions and "pew" sounds! By the time you're finished, you'll have learned to develop a number of important pieces to create your own games that focus in on that small, singular piece of joy that makes games fun.

This book shoots straight for the heart of fun, simple game design and keeps shooting until you have all the pieces you need to assemble your own great games.


The book takes a clear, step-by-step approach to building small, simple game projects. It focuses on short, attainable goals so that the reader can finish something, instead of trying to create a complex RPG or open-world game that never sees the light of day. This book encourages readers hungry for knowledge. It does not go into gory detail about how every little knob and dial functions – that's what the software manual is for! Rather, this book is the fastest path from zero to finished game using the Unity 3D engine.

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 kick-start for developers coming from other tools like Flash, Unreal Engine, and Game Maker Pro.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software