Book Image

Unity 2018 By Example - Second Edition

Book Image

Unity 2018 By Example - Second Edition

Overview of this book

Unity is the most exciting and popular engine used for developing games. With its 2018 release, Unity has become the primary source of both game development and virtual reality content. In Unity 2018 By Example, you’ll learn how to use Unity in order to make amazing games from popular genres - from action shooters to mind-bending puzzle games to adventure and Virtual Reality (VR) games. Even if you have no previous experience of using Unity, this book will help you understand the toolsets it provides in depth. In addition to this, you'll understand how to create time-critical collection games, twin-stick space shooters, platformers, and action-fest games with intelligent enemies. Finally, you'll get to grips with creating VR games with the new toolsets introduced by Unity to help you develop amazing VR experiences. To make things easier, you will be provided with step-by-step tutorials for making five great games in Unity 2018, along with a detailed explanation of all the fundamental concepts. By the end of this book, you’ll have established a strong foundation in making games with Unity 2018.
Table of Contents (16 chapters)
Unity 2018 By Example - Second Edition
Contributors
Preface
Other Books You May Enjoy
Index

Preface

Video games are a cultural phenomenon that has captivated, entertained, and moved billions of people worldwide over the past 50 years. As an industry and movement, video games are an exciting place to be, both for the developer and the artist. In these roles, your vision, ideas, and work can influence wide audiences, shaping and changing generation after generation in an unprecedented way. In more recent times, there's been a general movement toward democratizing game development, making the development process simpler, smoother, and more accessible to a wider audience, including developers perhaps working from home on a very limited budget. Instrumental in this movement is the Unity engine, which forms the main subject of this book. The Unity engine is a computer program that works with your existing asset pipeline (such as 3D modeling software) and is intended for compiling video games that work seamlessly across multiple platforms and devices, including Windows, Mac, Linux, Android, iOS, and Windows Phone. Using Unity, developers import ready-made assets (such as music, textures, and 3D models), and assemble them into a coherent whole, forming a game world that works by a unified logic. Unity is an amazing program. The latest version is free for most people to download and use, and it works well with many other programs, including free software such as GIMP and Blender. This book focuses on the Unity engine and how it can be used in a practical context for making playable and fun games. No prior knowledge of Unity is expected, although some knowledge of programming and scripting (such as JavaScript, ActionScript, C, C++, Java, or C#) would be beneficial. Let's now take a look at what this book covers, on a chapter-by-chapter basis.

Who this book is for

You don't need to have any previous experience with Unity to enjoy Unity 2018 by Example, although you need to have basic knowledge of C#.

What this book covers

This book explores how to use the Unity engine in a hands-on, practical way by looking at concrete examples that result in real-world playable games. Specifically, it focuses on the implementation of 5 distinct projects divided across 10 chapters, 2 chapters per project. Let's take a look at what these projects are:

Chapter 1, Unity Fundamentals, begins our journey into Unity by creating a first-person collection game. This is a great starting point if you're totally new to Unity and are ready to create your first game.

Chapter 2, Creating a Collection Game, continues from the previous chapter and completes the first project. It assumes that you have completed the first chapter and brings a closure to our project, leading neatly to the next chapter.

Chapter 3, Creating A Space Shooter, marks the beginning of our second project, focusing on the creation of a space shooter game. Here, we'll create a project in which the player must shoot the oncoming enemies.

Chapter 4, Continuing the Space Shooter, completes the space shooter project, taking the project from its state in the previous chapter and adding final touches to it.

Chapter 5, Creating a 2D Adventure Game, enters the world of 2D and UI functionality. Here, we'll explore Unity's wide range of 2D features in making a side-view platformer game that relies on 2D physics.

Chapter 6, Continuing the 2D Adventure, completes the 2D adventure game project that was started in the previous chapter, adding the final touches and linking it together with the overarching game logic. This is a great place to see how multiple parts and facets of a game come together to form a whole.

Chapter 7, Creating Artificial Intelligence, focuses on artificial intelligence and creating enemies that can patrol, chase, and attack the player's character at relevant times, while cleverly navigating their way around the level.

Chapter 8, Continuing with Intelligent Enemies, brings closure to the AI project started in the previous chapter. Here, we'll see how to use finite-state machines to achieve powerful intelligence functionality that'll help us in a variety of scenarios.

Chapter 9, Entering Virtual Reality, explores how to create a first-person shooter in VR where the player must tackle waves on oncoming enemies. In this chapter, we'll lay the foundations for creating a VR game.

Chapter 10, Completing the VR Game, completes the VR project by adding gameplay elements, core functionality, and by creating a build.

Appendix, Test Your Knowledge Answers, the answers to the Test Your Knowledge section of each chapter.

To get the most out of the book

This book contains almost everything you need to follow along. Each chapter considers practical, real-world projects for learning Unity and includes companion files that can be downloaded and used. The only thing you need, apart from this book and your concentration, is a copy of the latest version of Unity. At the time of writing, this is Unity 5.3.1. This software is available for free as a personal edition, and it can be downloaded from the Unity website at https://unity3d.com/. In addition to Unity, if you want to create props, character models, and other 3D assets, you'll also need 3D modeling and animation software, such as 3DS Max, Maya, or Blender; you'll also need image editing software, such as Photoshop or GIMP. Blender can be downloaded and used for free from http://www.blender.org/. Also, GIMP can be downloaded and used for free from https://www.gimp.org/.

Download the example code files

You can download the example code files for this book 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 emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at http://www.packtpub.com.

  2. Select the SUPPORT tab.

  3. Click on Code Downloads & Errata.

  4. Enter the name of the book in the Search box and follow the on-screen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows

  • Zipeg / iZip / UnRarX for Mac

  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Unity-2018-By-Example-Second-Edition. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/Unity2018ByExampleSecondEdition_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example; "Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system."

A block of code is set as follows:

[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)

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

[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)

Any command-line input or output is written as follows:

# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
     /etc/asterisk/cdr_mysql.conf

Bold: Indicates a new term, an important word, or words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this. For example: "Select System info from the Administration panel."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected], and mention the book's title in the subject of your message. If you have questions about any aspect of this book, please email us at .

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book we would be grateful if you would report this to us. Please visit, http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit http://authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.