Beginning 3D Game Development with Unity

All-in-one, multi-platform game development

By Sue Blackman

Beginning 3D Game Development with Unity Cover Image

Beginning 3D Game Development with Unity introduces key game production concepts in an artist-friendly manner, removes the hurdles to understanding scripting. It enables independent game artists to learn how to produce casual games for mobile, desktop, and console platforms.

Full Description

  • ISBN13: 978-1-4302-3422-7
  • 992 Pages
  • User Level: Beginner to Intermediate
  • Publication Date: May 24, 2011
  • Available eBook Formats: EPUB, MOBI, PDF
  • Print Book Price: $44.99
  • eBook Price: $31.99
Buy eBook Buy Print Book Add to Wishlist

Related Titles

Full Description

Beginning 3D Game Development with Unity is perfect for those who would like to come to grips with programming Unity. You may be an artist who has learned 3D tools such as 3ds Max, Maya, or Cinema 4D, or you may come from 2D tools such as Photoshop and Illustrator. On the other hand, you may just want to familiarize yourself with programming games and the latest ideas in game production.

This book introduces key game production concepts in an artist-friendly way, and rapidly teaches the basic scripting skills you'll need with Unity. It goes on to show how you, as an independent game artist, can create casual interactive adventure games in the style of Telltale's Tales of Monkey Island, while also giving you a firm foundation in game logic and design.

  • The first part of the book explains the logic involved in game interaction, and soon has you creating game assets through simple examples that you can build upon and gradually expand.
  • In the second part, you'll build the foundations of a point-and-click style first-person adventure game—including reusable state management scripts, load/save functionality, a robust inventory system, and a bonus feature: a dynamically configured maze and mini-map.
  • With the help of the provided 2D and 3D content, you'll learn to evaluate and deal with challenges in bite-sized pieces as the project progresses, gaining valuable problem-solving skills in interactive design.
By the end of the book, you will be able to actively use the Unity 3D game engine, having learned the necessary workflows to utilize your own assets. You will also have an assortment of reusable scripts and art assets with which to build future games.

What you’ll learn

  • How to build interactive games that work on a variety of platforms
  • Take the tour around Unity user interface fundamentals, scripting and more
  • Create a test environment and gain control over functionality, cursor control, action objects, state management, object metadata, message text and more
  • What is inventory logic and how to manage it
  • How to handle 3D object visibility, effects and other special cases
  • How to handle variety of menus and levels in your games development
  • How to handle characters, scrollers, and more
  • How to create or integrate a story/walkthrough

Who this book is for

Students or artists familiar with tools such as 3ds Max or Maya who want to create games for mobile platforms, computers, or consoles, but with little or no experience in scripting or the logic behind games development.

Table of Contents

Table of Contents

  1. Exploring the Genre
  2. Unity UI—Basics and Getting Started
  3. Scripting—Getting your Feet Wet
  4. Terrain Generation—Creating a Test Environment
  5. Navigation and Introduction to Functionality
  6. Cursor Control
  7. Action Objects
  8. Managing State
  9. Object Metadata
  10. Message Text
  11. Inventory Logic
  12. Managing the Inventory
  13. Finishing the Basic Functionality
  14. Getting Down to the Game
  15. Maze and Final Sequence
  16. Menus and Levels
  17. Beyond the Basics
  18. Appendix A: Shader Graphs
  19. Appendix B: Keyboard Key Names
  20. Appendix C: Final Sequence Outline
Source Code/Downloads

Downloads are available to accompany this book.

Your operating system can likely extract zipped downloads automatically, but you may require software such as WinZip for PC, or StuffIt on a Mac.

Errata

Please Login to submit errata.

On page 102:

Text states that backslashes are to be used to comment out code but forward slashes are used.

On page 250-251:

E-book Version Page 251

Code starts at step 10. Previous page is the first page of the chapter. no code involved on first page.
Missing pages that list code steps 1 - 9.
had to pull the code from the source code download, but i don't know the changes made in the UI that are not code.

On page 300-308:
The final portions of this exercise do not function properly in Unity 3.42.

Even when utilizing the author's source code, the Interactor script generates the following compiler error.

"Assets/Adventure Scripts/Interactor.js(47,53): BCE0120: 'GameManager.navigating' is inaccessible due to its protection level."


On page 308:
In step 5., when you enter this line of code in the Interactor script:
if (controlCenter.getComponent(GameManager).navigating) return;

and then try to run the game, you will get this error:
Assets/Adventure Scripts/Interactor.js(47,53): BCE0120: 'GameManager.navigating' is inaccessible due to its protection level.

This is because in the GameManager script, the variable "navigating" is set to private. This works in versions of Unity of to 3.3, but as of 3.4, the Javascript compiler will not access private variables of other scripts.

To fix the error, in the GameManager script, remove "private" from the variable so that the line now reads:
var navigating : boolean; // flag for navigation state

On page 414:

Page 414, paragraph 2, sentence 3 reads:
In going from state zero (unlocked)...

It should say:
In going from state zero (locked)...

On page 430:
On page 430, steps 5 - 7 are rather unclear and confusing, especially to those that are new to Unity and possibly scripting in general.

First, in the text, one of the pieces of data to be added is written as "Key Icon", including the space in-between the words, yet in figure 8-13 it is shown as "Icon_Key". Which is it?

Second, in step 7, several operations are condensed down into a list, which would normally be okay, except this is the first introduction to using an array in Unity and it should have been broken down into smaller steps. This is made all the more confusing by the structure of the sentence used to convey the instructions.

The sentence starts with "Set the other two arrays to Size 1 and fill in their data...", which makes sense, since we have already filled in the data for the first array in a previous step. The problem is that the following list also provides the data for the first array, which still wouldn't be all that confusing in itself except that it is labeled as State 0:, State 0:, State 1:, State 2:. None of these "states" are actual labels in the arrays. It is up to the reader to deduce what these mean and where to put what, and while this may be obvious to someone with experience, it most likely is not to the beginner.

It would have been much better if the list were written as:
Lookup State 0:
element 0: default,0
element 1: Icon_Key,1,KeyAtLock,1,Icon_Key,0

Lookup State 1:
element 0: default,0,KeyAtLock,0,Icon_Key,2

Lookup State 2:
element 0: default,2

This would follow the actual layout and syntax of the inspector much better. About the only way for the reader to figure this out in its current state is by comparing what's written to figure 8-13, which is actually another compounding factor in the confusion, because the screenshot in the book is almost illegible. Even with a magnifying glass it's a low-res grayscale image and difficult to figure out.

On page 462:
The first sentence in paragraph 3 states:
"In the Textures folder provided as part of this book's download, you will see a texture called MyBox."

The texture is actually found here:
BookAssets\Animation Tests\Textures\MyBox.psd

On page 472:
If the readers works through the tutorials up to step 5 and then tests, they will get the following error:
"...'GameManager.longDesc' is inaccessible due to its protection level."

This is because, as of Unity 3.4, variables set in scripts that are accessed by other scripts can no longer be set to private.

To fix this and a related error, open the GameManager script and change:
private var shortDesc : String = "";
private var longDesc : String = "";

to:
var shortDesc : String = "";
var longDesc : String = "";

On page 473:
In the metadata table for the Pedestal, Element0 in "Description" says:
"it is an extremely ugly stone"

This should actually say something about the pedestal. entering it as shown won't cause any problems but could possibly be confusing if you are testing.

On page 474:
In step 13, instead of entering:
private var inRange : boolean;

enter:
var inRange : boolean;

Otherwise, as of Unity 3.4, you will get the error:
'GameManager.inRange' is inaccessible due to its protection level.

On page 475:
As of Unity 3.4, all variables set in a script that are accessed by another script must be public. Otherwise you will get the error, "... is inaccessible due to its protection level."

In the CustomCursor script, change the line:
private var currentCursor : Texture;

To:
var currentCursor : Texture;
This will resolve the error.

On page 943, 944:
In Appendix B: Key Codes, many of these are incorrect.
For instance: all codes for the keypad are listed as "keypad1", "keypad2", etc.

These actually have to be the character surrounded by square brackets: "[1]", "[2]", etc. Inputing them as listed in the book will result in Unity rejecting it.

The list of codes can be found in the "Input" section of the Unity manual, but as is the case with most Unity docs, the list is incomplete, but it does at least provide the basic format for all special keys.