Book Image

Unity 3.x Game Development Essentials

By : Will Goldstone
Book Image

Unity 3.x Game Development Essentials

By: Will Goldstone

Overview of this book

Game Engines such as Unity are the power-tools behind the games we know and love. Unity is one of the most widely-used and best loved packages for game development and is used by everyone, from hobbyists to large studios, to create games and interactive experiences for the web, desktop, mobile, and console. With Unity’s intuitive, easy to learn toolset and this book – it’s never been easier to become a game developer. Taking a practical approach, this book will introduce you to the concepts of developing 3D games, before getting to grips with development in Unity itself – prototyping a simple scenario, and then creating a larger game. From creating 3D worlds to scripting and creating game mechanics you will learn everything you’ll need to get started with game development. This book is designed to cover a set of easy-to-follow examples, which culminate in the production of a First Person 3D game, complete with an interactive island environment. All of the concepts taught in this book are applicable to other types of game, however, by introducing common concepts of game and 3D production, you'll explore Unity to make a character interact with the game world, and build puzzles for the player to solve, in order to complete the game. At the end of the book, you will have a fully working 3D game and all the skills required to extend the game further, giving your end-user, the player, the best experience possible. Soon you will be creating your own 3D games with ease!
Table of Contents (21 chapters)
Unity 3.x Game Development Essentials
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Game Engines such as Unity are the power-tools behind the games we know and love. Unity is one of the most widely-used and best loved packages for game development and is used by everyone from hobbyists to large studios to create games and interactive experiences for the web, desktops, mobiles, and consoles. With Unity's intuitive, easy to learn toolset and this book, it's never been easier to become a game developer.

Taking a practical approach, this book will introduce you to the concepts of developing 3D games, before getting to grips with development in Unity itself—prototyping a simple scenario, and then creating a larger game. From creating 3D worlds to scripting and creating game mechanics you will learn everything you'll need to get started with game development.

This book is designed to cover a set of easy-to-follow examples, which culminate in the production of a First Person 3D game, complete with an interactive island environment. All of the concepts taught in this book are applicable to other types of game, however, by introducing common concepts of game and 3D production, you'll explore Unity to make a character interact with the game world, and build problems for the player to solve, in order to complete the game. At the end of the book, you will have a fully working 3D game and all the skills required to extend the game further, giving your end-user - the player - the best experience possible. Soon you will be creating your own 3D games and interactive experiences with ease!

What this book covers

Chapter 1, Enter the Third Dimension: In this chapter, we will introduce you to the concepts of working in 3D and how game development works with Unity. Having covered how 3D development works, you will learn the core windows that make up the Unity Editor environment.

Chapter 2, Prototyping and Scripting Basics: In this chapter, we aim to get you started with a practical approach to learning Unity, by building a simple game mechanic prototype, and working with C# (pronounced C-Sharp) or Javascript scripting as you get to grips with your first Unity interaction.

Chapter 3, Creating the Environment: Now that you have a grasp on how to make use of Unity, and it's processes, in this chapter you will begin to design outdoor environments—using the Terrain toolset to create an island environment.

Chapter 4, Player Characters and Further Scripting: With our island environment completed, we will look at how Player Characters are constructed in Unity, looking at scripting for characters, and also learning further scripting concepts that will be essential as you continue to create further interactions in Unity.

Chapter 5, Interactions: This key chapter will teach you three of the most important processes in game design with Unity—interaction using Collisions, detection of objects using Ray casting, and collider intersect detection using Trigger areas.

Chapter 6, Collection, Inventory, and HUD: With a variety of interactions covered, we will put this knowledge into further practice as we learn how to make a simple inventory for the player, and an accompanying heads up display to record items collected.

Chapter 7, Instantiation and Rigidbodies: To put interaction into practice once more, we will make use of Unity's built-in physics engine, and learn how to combine this with animation to create a shooting mini-game.

Chapter 8, Particle Systems: Taking a break from scripting, we'll dive into some of Unity's visual effects to create a campfire using Particle systems-making systems for fire and smoke.

Chapter 9, Designing Menus: Every good game needs a user interface, and in this chapter we will take a look at two differing approaches to creating menus in Unity: with GUI Texture components and with the GUI scripting class.

Chapter 10, Animation Basics: To keep your Unity games looking dynamic, it's important to learn how to animate in Unity. In this chapter, we'll create a game ending sequence of titles and learn how to animate via scripting and also with Unity's Animation window.

Chapter 11, Performance Tweaks and Finishing Touches: Whilst it's important to get gameplay just right, it's also nice to make sure your game looks polished before it's ready to unleash on your audience. In this chapter, we'll look at further visual effects and optimization to make your game shine and perform well.

Chapter 12, Building and Sharing: In order to grow as a developer, it's really important to share your work with players, and get feedback. In this chapter, we'll learn how you can export your game as a standalone executable, and as a web player, so that you can do just that.

Chapter 13, Testing and Further Study: In this concluding chapter, we will look at ways of receiving feedback from your player, and give you some advice to stand you in good stead as you begin your career in development with Unity. This chapter also features some recommended further reading to cover as you progress from the confines of this book to becoming a fully-fledged game developer!

Glossary: The glossary contains descriptions of common terms that you might encounter and also serves as a handy reference

Note

The Glossary is not present in the book but is available as a free download from the following link:

http://www.packtpub.com/sites/default/files/downloads/1444OT_Glossary_Final.pdf

What you need for this book

For this book you will be required to download the free version of Unity, available at:

http://www.unity3d.com/unity/download

Your computer should also meet the following specifications, as stated on the Unity website:

  • Windows: XP SP2 or later.

  • Mac OS X: Intel CPU and "Leopard" 10.5 or later.

  • Graphics card with 64 MB of VRAM and pixel shaders or 4 texture units. Any card made in this millennium should work.

For the latest requirements, see the Unity website:

http://unity3d.com/unity/system-requirements.html

Who this book is for

If you're a designer or animator who wishes to take their first steps into game development or prototyping, or if you've simply spent many hours sitting in front of video games with ideas bubbling away in the back of your mind, Unity and this book should be your starting point. No prior knowledge of game production is required, inviting you to simply bring with you a passion for making great games.

Getting help with the book and updates

This book is written with Unity version 3.4.2 in mind, and is tested for that version. However, in some rare cases, despite stringent checks of the text, book releases may feature errors that cause confusion to readers. Also, as Unity evolves and new versions of the software are released, parts of this book may need updating.

To keep you totally up to date, we're providing you with the following website in order to give you up to date changes to what is written in the book, and also any changes that are made to Unity itself - making sure that this book is always up to date with Unity's latest practices. So if you stumble upon a problem you think may have changed, or simply need help understanding the book, visit the following URL:http://www.unitybook.net

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Set the fps variable to the Rounded value of frames."

A block of code is set as follows:

// Matches
private var haveMatches : boolean = false;
var matchGUIprefab : GUITexture;

Some code lines are long, and end up running onto new linesmake sure that you do not do this in your code. Remember that code lines are terminated by a semi-colon ; so wherever possible, keep code on a single line. In the example below, space restraints forces this to be displayed on two lines but in your script editor, you should not place a new line to achieve this:

new Vector3(Mathf.Lerp(xStartPosition, xEndPosition, (Time.time-startTime)*speed), transform.position.y,transform.position.z);

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Go to File | Save in the script editor, and switch back to Unity."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail .

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the book asset bundle

You can download the required files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you. An updated repository of the asset bundle for this book is also available at http://unitybook.net/book_assets.unitypackage.zip.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots used in this book. The color images will help you better understand the changes in the output. You can download this file fromhttp://www.packtpub.com/sites/default/files/downloads/1444_Images.pdf

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from and can also be viewed at

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.