Book Image

Unity Game Development Blueprints

By : John P. Doran
Book Image

Unity Game Development Blueprints

By: John P. Doran

Overview of this book

Table of Contents (16 chapters)
Unity Game Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Unity, available in free and pro versions, is one of the most popular third-party game engines available. It is a cross-platform game engine, making it easy to write your game once and then port it to PC, consoles, and even the Web, which makes it a great choice for both indie and AAA developers.

Unity Game Development Blueprints takes readers on an exploration into using Unity to the fullest extent, working on 3D and 2D titles, exploring how to create GUIs, and publishing the game for the world to see. Using this book, you will be able to create a 2D twin-stick shooter, a side-scrolling platformer with an in-game level editor, a first-person survival horror shooter game, and a GUI menu system to use in all your future titles. In addition, you will learn how to publish your game with an installer to make your title look really polished and stand out from the crowd.

Each chapter either pushes your skills in Unity into new areas or pushes them to the very limits of what they can be used for. Finally, we will also explore Unity's new GUI system, which is currently in beta, showing examples while discussing the advantages and disadvantages of using it.

What this book covers

Chapter 1, 2D Twin-stick Shooter, shows us how to create a 2D multidirectional shooter game. In this game, the player controls a ship that can move around the screen using the keyboard and shoot projectiles in the direction the mouse is pointing at. Enemies and obstacles will spawn towards the player, and the player will avoid/shoot them. This chapter will also serve as a refresher on a lot of the concepts of working in Unity and give an overview of the recent addition of native 2D tools to Unity.

Chapter 2, Creating GUIs, will expand on our twin-stick shooter game, adding additional UI elements, including a main menu as well as a pause menu and options menu, and will give us the ability to restart our project.

Chapter 3, Side-scrolling Platformer, shows us how to create a side-scrolling platformer. We will learn the similarities between working in 2D and 3D and the differences, in particular, when it comes to Physics.

Chapter 4, First Person Shooter Part 1 – Creating Exterior Environments, discusses the role of a level designer who has been tasked to create an outdoor environment while learning about mesh placement. In addition, we will also learn some beginner-level design.

Chapter 5, First Person Shooter Part 2 – Creating Interior Environments, discusses the role of a level designer who has been tasked to create an interior environment using assets already provided to us by the environment artist.

Chapter 6, First Person Shooter Part 3 – Implementing Gameplay and AI, shows how we are going to be adding in interactivity in the form of adding in enemies, shooting behaviors, and the gameplay to make our game truly shine. In addition, we'll also learn how to use an Xbox 360 Controller to accept input in our game.

Chapter 7, Creating Save Files in Unity, talks about how to add in functionality to some of our previously created games, adding in high scores and even an in-game level editor that can be used for future projects.

Chapter 8, Finishing Touches, talks about exporting our game from Unity and then creating an installer so that we can give it to all of our friends, family, and prospective customers!

Chapter 9, Creating GUIs Part 2 – Unity's New GUI System, explores Unity's new GUI system, including creating health bars that move with characters, with text. We will also learn how to work with buttons using the new system, while also having elements scale correctly to work with any resolution.

What you need for this book

Throughout this book, we will work within the Unity 3D game engine, which you can download from http://unity3d.com/unity/download/. The projects were created using Version 4.5.3, but the project should work with minimal changes, with differences between this version and the 4.6 beta being pointed out when they occur. In Chapter 9, Creating GUIs Part 2 – Unity's New GUI System, since we are using the new GUI system, we will be using the Unity beta version, which can be downloaded from http://unity3d.com/unity/beta/4.6.

For the sake of simplicity, we will assume that you are working on a Windows-powered computer. Though Unity allows you to code in either C#, Boo, or UnityScript; for this book, we will be using C#.

Who this book is for

This book is for those who want to do more with Unity and have a series of completed projects by the end of the book. Readers who are familiar with the basics of how to create things in Unity will have an easier time.

Conventions

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

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Once inside, go to your operating system's browser window, open up the Chapter 1/Assets folder that we provided, and drag the playerShip.png file into the folder to move it into our project."

A block of code is set as follows:

// Add game's title to the screen, above our button
GUI.Label( new Rect(buttonX + 2.5f , 
               buttonY - 50, 
               110.0f, 20.0f), 
 "Twinstick Shooter", titleStyle );

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

// Add game's title to the screen, above our button
GUI.Label( new Rect(buttonX + 2.5f , 
                      buttonY - 50, 
                      110.0f, 20.0f), 
 "Twinstick Shooter", titleStyle );

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes, appear in the text like this: "From there, click on Folder, and you'll notice that a new folder has been created inside of your Assets folder."

Note

Warnings or important notes appear in a box like this.

Tip

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 as it helps us develop titles that you really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

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 at 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 example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. 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.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/3655OT_Graphics.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/submit-errata, 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. To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted 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

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.