Unity 4.x Game Development by Example: Beginner's Guide


Unity 4.x Game Development by Example: Beginner's Guide
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
$9.99
save 63%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
$44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Learn the basics of the Unity 3D game engine by building five small, functional game projects
  • Explore simplification and iteration techniques that will make you more successful as a game developer
  • Take Unity for a spin with a refreshingly humorous approach to technical manuals

Book Details

Language : English
Paperback : 572 pages [ 235mm x 191mm ]
Release Date : December 2013
ISBN : 1849695261
ISBN 13 : 9781849695268
Author(s) : Ryan Henson Creighton
Topics and Technologies : All Books, Unity, Beginner's Guides, Games


Table of Contents

Preface
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: Hearty Har Har
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: Game #5 – Kisses 'n' Hugs
Chapter 13: AI Programming and World Domination
Chapter 14: Action!
Appendix
Index
  • Chapter 1: That's One Fancy Hammer!
    • Introducing Unity 3D
    • The engine, the tool, and the all-weather tires
    • Unity takes over the world
    • Why choose Unity?
    • Why burn this book and run away screaming?
    • 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 promises
      • Maybe we should build Off-Road Velociraptor Safari?
    • I bent my Wooglie
      • Big Fun Racing
      • Diceworks
      • Lovers in a Dangerous Spacetime
      • Showcase Showdown
    • Unity Technologies – "Made with Unity" page
    • Kongregate
    • The iOS App Store
    • Walk before you can run (or double jump)
    • There's no such thing as "finished"
    • Stop! Hammer time
      • Fight Some Angry Bots
    • The wonders of technology!
    • The Scene window
      • The Game window
      • The Hierarchy panel
      • The Project panel
      • The Inspector panel
      • Heads Up?
      • 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
      • Possible additional features:
    • Heads up!
    • Artillery Live!
      • The skinny on multiplayer
      • Bang for your buck
    • 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 wants to 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
      • Cameramania
    • Time for action – test your game
    • Let's get physical
    • 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 re-appear
    • 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
    • Why didn't the Paddle animate before?
    • Pick a word – (almost) any word
    • Screen coordinates versus World coordinates
    • Move the Paddle
    • Worst. Game. Ever.
    • See the matrix
    • Time for action – listen to 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 – re-visit 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?
      • WHAT THE HECK IS A QUATERNION??
    • Educated guesses
      • More on Slerp
    • Right on target
    • Keep it up
      • Beyond the game mechanic
    • C# Addendum
  • 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 mip-mapping
    • Front and center
    • Time for action – center the button
    • The waiting game
    • The easiest button to button
    • To the game!
    • Time for action – add both scenes to 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
    • A matter of great import
    • Building a better bucket
    • How big is your locker?
    • 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!
    • C# addendum
  • Chapter 6: Game #2 – Robot Repair Part 2
    • From zero to game in one chapter
    • Finding your center
    • Time for action – centering the game grid vertically
    • Time for action – centering the game grid horizontally
    • Down to the nitty griddy
      • Do the random card shuffle
    • Time for action – preparing to build the deck
      • Let's break some robots
    • Time for action – building the deck
    • Time for action – modifying the img argument
    • What exactly is "this"?
    • Random reigns supreme
    • Second dragon down
    • Time to totally flip
    • Time for action – making the cards two-sided
    • Time for action – building the card-flipping function
    • Time for action – building the card-flipping function
    • Pumpkin eater
    • Stabby McDragonpoker rides again
    • Game and match
    • Time for action – ID the cards
    • Time for action – comparing the IDs
    • On to the final boss
      • Endgame
    • Time for action – checking for victory
      • Endgame
    • Bring. It. On.
    • C# Addendum
  • Chapter 7: Don't Be a Clock Blocker
    • Apply pressure
    • Time for action – preparing the Clock Script
    • Time for more action – preparing the clock text
    • Still time for action – changing the clock text color
    • Time for action rides again – creating Font Texture and Material
    • Time for action – what's with the tiny font?
    • Time for action – preparing the clock code
    • Time for action – creating the countdown logic
    • Time for action – displaying the time on-screen
    • Picture it
    • Time for action – grabbing 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 – rigging up the textures
    • Time for action – writing the pie chart script
    • Time for action – commencing operation pie clock
    • Time for action – positioning and scaling the clock
    • Unfinished business
    • C# Addendum
  • Chapter 8: Hearty Har Har
    • Welcome to Snoozeville
    • Model behavior
    • Time for action – exploring the models
    • Time for action – hands up!
    • Time for action – changing the FBX import scale settings
    • Time for action – making the mesh colliders convex
    • Time for action – making the hands and tray follow the mouse
    • Time for action – getting your heart on
    • Time for action – ditching the Ball and Paddle
    • Time for action – material witness
    • This just in – this game blows
    • Time for action – multiple erections
    • Time for action – creating a font texture
    • Time for action – create the HeartBounce script
    • Time for action – tagging the tray
    • Time for action – tweaking the bounce
    • Time for action – keeping track of the bounces
    • Time for action – adding the lose condition
    • Time for action – adding the Play Again button
    • Ticker taken
    • C# Addendum
  • Chapter 9: Game #3 – The Break-Up
    • Time for action – bombs away!
    • Time for action – poke those particles
    • Time for action – creating a spark material
    • Time for action – prefabulous
    • Time for action – lights, camera, and apartment
    • Time for action – adding the character
    • Time for action – registering the animations
    • Time for action – scripting the character
    • Time for action – open the pod bay door, Hal
    • Time for action – collision-enable the character
    • Time for action – apocalypse now?
    • Time for action – go boom
    • Time for action – kill kill murder die
    • Time for action – the point of impact
    • Time for action – hook up the explosion
    • Summary
    • C# addendum
  • 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 FallingObject
    • Silent 'Splosion
    • What's the catch?
    • Time for action – mix it up a bit
    • Summary
    • C# Addendum
  • Chapter 11: Game #4 – Shoot the Moon
    • Time for action – duplicate your game project
    • Time for action – space the shooter 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
    • C# Addendum
  • Chapter 12: Game #5 – Kisses 'n' Hugs
    • Computers that think
    • Time for action – haul in the hallway
    • Time for action – hash it out
    • One Script to rule them all
    • Time for action – it's hip to be square
    • Squaring the Square
    • Time for action – now you see it...
    • Family values
    • Time for action – X marks the spot
    • Time for action – boy O boy
    • Time for action – bottoming out
    • Here comes the drop
    • Time for action – +9 accuracy
    • Time for action – solve for X
    • Time for action – it takes two to Tic Tac Toe
    • Time for action – designer to player. Come in, player.
    • Slowly building to a climax
    • Read after thinking
    • On deaf ears
    • Time for action – pretty maids all in a row
    • Winner is coming
    • Codesplosion
    • Need-to-know basis
    • Need-to-know basis
    • Clean-up on aisle code
    • Shave and a haircut
    • Time for action – check for a win
    • Sore loser
    • Time for action – notify the winner
    • Time for action – you win. Now what?
    • Nice moves
    • Time for action – the final bug
    • All done but for the shouting
    • C# addendum
  • Chapter 13: AI Programming and World Domination
    • Take it away, computer
    • Time for action – add computer control
    • Herpa derp derp
    • Unpacking the code
    • Time for action – code consolidation
    • Tic Tac Toe at the speed of light
    • Sore loser
    • Click-spamming for fun and profit
    • Artificial stupidity
    • Time for action – winning is everything
    • It's a trap!
    • The leftovers
    • Time for action – pseu pseu pseudocode
    • Time for action – begin at the end
    • Time for action – the final four
    • Code one, get one free
    • The actual intelligence behind artificial intelligence
    • Time for action – score!
      • Shut your trap
      • Detecting the tri-corner trap
    • Time for action – to catch a competitor
      • Perfection Horrible, horrible perfection.
    • Time for action – programming fallibility
      • Turning it up to "Smart"
      • Code encore
    • Summary
      • More hospitality
    • C# addendum
  • Chapter 14: Action!
    • Open heart surgery
    • Time for action – haul in the hallway
    • Time for action – meet me at camera two
    • Time for action – adjust 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

Ryan Henson Creighton

Ryan Henson Creighton is a veteran game developer, and the founder of Untold Entertainment Inc. (http://www.untoldentertainment.com) where he creatively consults on games and applications. Untold Entertainment creates fantastically fun interactive experiences for players of all ages. Prior to founding Untold, Ryan worked as the Senior Game Developer at Canadian media conglomerate Corus Entertainment, where he created over fifty advergames and original properties for the YTV, Treehouse TV, and W networks. Ryan is the co-creator of Sissy's Magical Ponycorn Adventure, the game he authored with his then five-year-old daughter Cassandra. Ryan is the Vice President of the IGDA Toronto Chapter. He is also the author of the book that you are currently reading.

When Ryan is not developing games, he's goofing off with his two little girls and his funloving wife in downtown Toronto.

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.


Errata

- 9 submitted: last submission 11 Apr 2014

Errata type: Technical | Errata page: 299

Step 4, second sentence:

Click on the blank area beneath the 1 on the Sizeline.

should be:

Click on the blank area beneath the 2 on the Sizeline.

Errata type: Typo | Errata page: 199

The sentence after the information box:

Here, we use our random number to pull a body part out of the aRobotParts leneric list.

should be:

Here, we use our random number to pull a body part out of the aRobotParts generic list.

 

 

Errata type: Technical | Errata page: 294

In step 5: The paragraph will have the following underlined changes:

Repeat these steps to create three more Cubes called Wall Front, Wall Left,
and Wall Right. The best way to do this is to duplicate Wall Back three times.
Just right-click/alternate-click the Wall Back GameObject and choose "Duplicate"
from the context menu. These are the settings I used to place the other walls, but
feel free to tweak them to suit your taste:

Errata type: Code | Errata page: 125

A parenthesis is missing from the following code line under the *Somebody get me a bucket* section:

transform.position.x = Input.mousePosition.x – Screen.width/2)/(Screen.width/2);

It should be:

transform.position.x = (Input.mousePosition.x - Screen.width/2)/(Screen.width/2);

Errata type: Code | Errata page: 206

In step 3:

"Just above that line, find the cardvariable definition:
var card:Object = aGrid[i,j];"

The correct line of code should be:

"var card:Card = aGrid[i,j];"

Errata type: Code | Errata page: 213

In step 1 under the *Time for action – ID the cards* section:

Wrong: var card:Object; // this stores a reference to a card
Correct: var card:Card; // this stores a reference to a card

Errata type: Code | Errata page: 215

In step 2, in the code bundle:

Wrong: var card:Object = aGrid[i][j];
Corrected: var card:Card = aGrid[i,j]; <-- in addition to changing Object to Card, notice the [i,j] instead of [i][j]

Errata type: Technical | Errata page: 416


The first sentence of the page: Click on each square and, in the Inspector panel, its x and y values appropriately.

should be: Click on each square and, in the Inspector panel, change its x and y values appropriately.

Errata type: code | Errata page: 491

The explanation part under the line "private IEnumerator ShowStalematePrompt()", add the following:

In C#, coroutines (methods returning IEnumerator) must be started using the StartCoroutine-method, or else they will simply not run.

In Javascript, a coroutine is started like a regular method: ShowStalematePrompt();


In C#, a coroutine is started via StartCoroutine:
StartCoroutine(ShowStalematePrompt()); 

Note that StartCoroutine is only available on scripts that derive from MonoBehaviour. In Javascript, all scripts do this by default. In C#, look for the MonoBehaviour base class in the class declaration.


Errata Page: 492

gameLogic.GetComponent<GameLogicCSharp>().ClickSquare(gameObject);

should be:

StartCoroutine(gameLogic.GetComponent<GameLogicCSharp>().ClickSquare(gameObject));

Errata Page 498:

ShowWinnerPrompt(); should be StartCoroutine(ShowWinnerPrompt());

ShowStalematePrompt(); should be StartCoroutine(ShowStalematePrompt());

 

Errata type: code | Errata page: 222

In the 1st code snippet, add the following line of code:

var cardH:int=100;

After: var cardW:int = 100; // Each card's width and height is 100 pixels

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 4.x Game Development by Example: Beginner's Guide +    Node.js Blueprints =
50% Off
the second eBook
Price for both: £26.35

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

What you will learn from this book

  • Explore the basic development flow of the Unity 3D game engine
  • Understand fundamental programming concepts in both Javascript and C#
  • Develop five different games from inception to completion
  • Discover the secrets new game developers use to be successful when they're just starting out
  • Grasp the nuances of Unity's immediate-mode GUI
  • Completely re-skin a game for fun and (potentially) profit
  • Lengthen gameplay by learning how to use random numbers
  • Explore the process of writing Artificial Intelligence from scratch

In Detail

Unity is one of the biggest game engines in the world, providing the user with a range of important tools that they need to bring their ideas into reality. Beginner game developers are optimistic, passionate, and ambitious, but that ambition can be dangerous! Too often, budding indie developers and hobbyists bite off more than they can chew. Games like Angry Birds, Cut the Rope, and Fruit Ninja are 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, starting today.

This book teaches you the ins and outs of the unique Unity game engine interface. Clear and concise code examples written in both Unity Javascript and C# take you through the step-by-step process of building five small, functional games. With this understanding you can start making your own mark on the game industry!

With absolutely no programming or game development experience, you will learn how to build five simple games in Unity by following step-by-step instructions, peppered with amusing analogies and anecdotes from an experienced indie developer. Following a primer on simplifying your game ideas to that single “something” that keeps players coming back for more, dive into the Unity game engine by creating a simple bat-and-ball game. From there, you'll build a complete memory game using only the Unity GUI system. After building a 2.5D mouse avoider game, you'll learn how to re-skin the project to completely change the game's theme. Incorporating everything you've learned, you'll return to complete the bat-and-ball game by adding scoring, replay flow, sound effects, and animations. Finally, in the new bonus chapter, you'll program some simple AI (Artificial Intelligence) for a tic tac toe game.

"Unity 4.x Game Development by Example" is a fun and light-hearted exploration of one of the most powerful game engines on the market today. Find out what all the fuss is about by getting up to speed using this book!

Approach

This is a practical and light-hearted guide to get to grips with creating your first games, with easy-to-follow, step-by-step tutorials using the award winning Unity engine.

Who this book is for

If you’ve ever wanted to enter the world of independent game development but have no prior knowledge of programming or game development, then this is the book for you. Game developers transitioning from other tools like GameMaker and Flash will find this a useful tool to get them up to speed on the Unity engine, as will anyone who has never handled the Unity engine before.

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
Resources
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