Book Image

Unity 5.x By Example

By : Alan Thorn
Book Image

Unity 5.x By Example

By: Alan Thorn

Overview of this book

Unity is an exciting and popular engine in the game industry. Throughout this book, you’ll learn how to use Unity by making four fun game projects, from shooters and platformers to exploration and adventure games. Unity 5 By Example is an easy-to-follow guide for quickly learning how to use Unity in practical context, step by step, by making real-world game projects. Even if you have no previous experience of Unity, this book will help you understand the toolset in depth. You'll learn how to create a time-critical collection game, a twin-stick space shooter, a platformer, and an action-fest game with intelligent enemies. In clear and accessible prose, this book will present you with step-by-step tutorials for making four interesting games in Unity 5 and explain all the fundamental concepts along the way. Starting from the ground up and moving toward an intermediate level, this book will help you establish a strong foundation in making games with Unity 5.
Table of Contents (15 chapters)
Unity 5.x By Example
About the Author
About the Reviewer

Building an NPC

Now we'll build an NPC character that'll display artificial intelligence. To get started, we'll use the Ethan mesh included in the Unity native companion assets. This can be found in the Project panel under the Standard Assets | Characters | ThirdPersonCharacter | Models folder. From here, drag and drop the Ethan model to the scene and position it on the terrain. We'll refine and edit this model and, eventually, create a prefab from it to represent an NPC character. See Figure 7.25:

Figure 7.25: Starting an NPC character

When adding the Ethan model to the level, ensure that the blue forward vector of the character is pointing forward, facing the direction in which the character is actually looking. If the forward vector is not front-aligned, then create an empty object and align the character model to that as a child object so that the forward vector of the parent is pointing straight ahead, along the character's line of sight. That is, the blue forward vector should align...