With the pervasiveness of games and the use of gamification in nearly every industry, the desire to discover how to use state-of-the-art development software has never been so great. There is an increasing number of software tools available to help developers create amazing games for consoles, the web, desktop computers, and mobile devices. Game engines are among the most powerful of these tools available. The Unity 3D game engine is one of the elite game engines. It has been used to create popular 2D and 3D games by large game studios and indie developers. With a free version available, and the newest release of Unity, the time has never been better to start using Unity.
Getting Started with Unity 2018, Third Edition covers one of the most popular game engines available. This book will guide you through the entire process of creating a 3D game, from downloading the Unity game engine to publishing your game. You will enjoy the coverage of some exciting topics in this book, including player-controlled characters and animation. Whether you are just getting started as a game developer or have experience with Unity or other game engines, this book will provide you with a guided tour of developing games with Unity 2018. With clear explanations, tips, and ample screenshots, you will be provided with detailed steps to develop your game.
This book takes a practice hands-on approach to learning Unity 2018. As you progress through each chapter, you will build a 3D interactive game called Cucumber Beetle. As you create the game, you'll learn the key features of Unity 2018, including creating a game environment, animating characters, scripting, and more. All meshes, models, textures, animations, and other assets are available on the book's website.
By the time you complete the lessons in this book, you'll have the confidence to start using Unity 2018 to create your own games.
This book is written for people new to Unity or those who have some experience with a version prior to Unity 2018. If you want to take a look at Unity 2018, get a refresher, or if you just want to see how games can be developed with a top game engine, this book is for you.
Chapter 1, Downloading and Installing Unity, gives an overview of game engines, followed by a deep look at Unity's beginnings, where the game engine is today, and how it progressed to being one of the top game engines in use today. Unity's capabilities and features are highlighted, and instructions are provided for downloading and installing it.
Chapter 2, The Unity Interface, examines Unity's primary views, windows, layouts, and the toolbar. The interface components covered in this chapter are the ones used most often.
Chapter 3, Designing the Game, covers the design of the book's featured game—Cucumber Beetle. The game design includes gameplay, game mechanics, the player character, the non-player characters, game assets, animations, and more. Screen mock-ups and narratives are used to document the game's design.
Chapter 4, Creating Our Terrain, features the creation and customization of game terrain. Shaping tools are introduced, and water and vegetation features are added to the game environment.
Chapter 5, Lights, Cameras, and Shadows, explores cameras and lighting in Unity. The chapter starts with a look at cameras to include perspectives, frustums, and Skyboxes. The use of multiple cameras to include mini-maps is covered. Different types of lighting, reflection probes, and shadows are also explored.
Chapter 6, Creating and Importing 3D Objects for Our Game, focuses on making the game environment more robust, and trees and other objects are added to the game scene. This chapter also examines the steps necessary to create 3D objects using Unity's native modeling tools. Assets are added to the game from the Unity Asset Store and from 3D assets prepared specifically for the Cucumber Beetle game.
Chapter 7, Implementing Our Player Character, incorporates the game's player character—the Cucumber Man. The character is imported, and the controls and animations are reviewed. By the end of the chapter, the game will be ready for testing in the game mode.
Chapter 8, Implementing Our Non-Player Characters, explains the non-player characters—the Cucumber Beetles. The beetles' 11 animations are examined and changes are made to the non-player character's animation controller. In addition, scripts will be written to control the non-player characters. Also, in this chapter, cucumber patches, cucumbers, and cherries are added to the game world.
Chapter 9, Adding a Heads-Up Display, covers the design and development of, and how to incorporate, a Heads-Up Display (HUD) in the game. A canvas is used to create text and graphics that provide visual indicators of points, health, and additional information to help the player maintain situational awareness during game play. A mini-map is also implemented.
Chapter 10, Scripting Our Points System, looks at the design, scripting, and implementation of the game's point system. This includes providing frame-by-frame updates to key onscreen components of the game's HUD.
Chapter 11, Scripting Victory and Defeat, dives into the design and scripting of the game's victory and defeat conditions. Scripts will be updated to manage the Cucumber Man's health, provide frame-by-frame onscreen updates, and ensure that a player life is lost when the health runs out. Character lives and respawning are also covered.
Chapter 12, Adding Audio and Visual Effects to Our Game, demonstrates the plan and implementation of audio and visual effects in the game to help enhance overall game play. Specifically, audio is added to the key events in the combat system and several special effects, using Unity's particle system, are added to the game.
Chapter 13, Optimizing Our Game for Deployment, discusses optimization and deployment. The steps required to diagnose Unity games for performance problems are explored, in addition to how to optimize scripts and graphic rendering. The Unity build process is explained along with how to create a standalone player and how to deploy games for multiple platforms.
Chapter 14, Virtual Reality, examines Unity's capabilities with regard to virtual reality. An introduction to Virtual Reality is provided, including the hardware requirements. you will learn how to create a Virtual Reality game using the Unity game engine.
You do not need to have experience of programming, working with game engines, or knowledge of Unity to benefit from this book. No assumptions have been made regarding knowledge or experience.
The only software requirement is downloading and installing the Unity game engine. Those steps are detailed in the book, so no software is required before you start reading.
You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packtpub.com.
- Select the SUPPORT tab.
- Click on Code Downloads & Errata.
- Enter the name of the book in the Search box and follow the onscreen 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/Getting-Started-with-Unity-2018-Third-Edition. In case there's an update to the code, it will be updated on 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!
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: http://www.packtpub.com/sites/default/files/downloads/GettingStartedwithUnity2018ThirdEdition_ColorImages.pdf.
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. Here is an example: "Ensure the
Skybox folder is selected in the
A block of code is set as follows:
public AudioSource audioSource; public AudioClip eating; public AudioClip attack; public AudioClip die;
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select Fill option from the HUD_canvas."
Feedback from our readers is always welcome.
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 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
[email protected] 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 authors.packtpub.com.
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.