Packt
Publishing released a new book on Unity scripting in February of this
year.
Entitled
“Mastering Unity Scripting” it was written by Alan Thorn who has authored
several other books on Unity and UDK. Like most Packt Publishing titles this
book includes the book’s files and a PDF of the colored images from the book
that you can download from their website.
This is an advanced book using Unity’s version of C# and it certainly
helps to have completed a few Unity tutorials.
That being said the first two chapters of the book are C# refreshers and
cover the basics of creating a project. The book then reviews C# all the way
through classes and polymorphism.
Chapter
three covers Singletons which are ways of making an object persist throughout
all of the levels and parts of your game.
Singletons are the GameManager,
HighScoreManager, and the SaveGameManager of your game. This chapter also discusses many other facets
of game objects including when to update and change them.
Chapter
four discusses event-driven programming and how to use this method for
optimizing your game. Essentially the
updating of game objects is removed from the Update function of your class and
placing them into new classes that are driven by the events of the game. This seems to be a useful technique for all
but the smallest of games.
Chapter
five is all about cameras, using multiple ones, their placement and working
with line of sight issues. Chapter six
talks about working with MonoDevelop the IDE that comes with Unity. MonoDevelop has useful features that Unity
programmers can use build extra functionality into their games. The IDE also
allows you to use regular expressions and LINQ (querying of databases) in
Unity.
Chapter
seven demonstrates how to create artificial intelligence in Unity. The whole idea of artificial intelligence is
to have enemies appear to make intelligent decisions based on what the player
does. I really enjoyed this chapter as
it has clear examples of using Finite State Machines (FSM) to make NPC
characters appear to be intelligent.
Chapter
eight discusses ways of adding functionality to the Unity editor. Unity’s editor allows you to do many things
and the asset store allows you to purchase the ability to do many more. Sometimes it’s easier to just program these
abilities on your own. One of the nice
examples that’s included in this chapter is setting up your game so that you
can localize it into many different languages.
Chapters
nine covers Unity 2D objects and textures.
Specifically, setting up a skybox where clouds are rotating is explained
through an example that is provided. Examples are also given for setting up an
asset database and setting up a scrolling texture for your game.
Chapter
ten discusses setting up source control, specifically Git, for your game. Creating save game files and resource files
is also explained. These features are
important to most games, so it is wonderful that this is explained here.
Overall
I enjoyed “
Mastering Unity Scripting”
and would recommend that everyone purchases this book.
It is a great reference book that explains
how to code in Unity many different aspects of game design that most game
creators will need at some point in their game development career.
Alan Thorn’s website is at
http://www.alanthorn.net/.