Unity 2020 By Example
eBook - ePub

Unity 2020 By Example

A project-based guide to building 2D, 3D, augmented reality, and virtual reality games from scratch, 3rd Edition

Robert Wells

Buch teilen
  1. 676 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Unity 2020 By Example

A project-based guide to building 2D, 3D, augmented reality, and virtual reality games from scratch, 3rd Edition

Robert Wells

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

Learn Unity game development with C# through a series of practical projects ranging from building a simple 2D game to adding AR/VR experiences and machine learning capabilities in a simple yet effective way

Key Features

  • Gain a high-level overview of the Unity game engine while building your own games portfolio
  • Discover best practices for implementing game animation, game physics, shaders, and effects
  • Create fully featured apps, including Space shooter and a 2D adventure game, and develop AR/VR experiences and Game AI agents

Book Description

The Unity game engine, used by millions of developers around the world, is popular thanks to its features that enable you to create games and 3D apps for desktop and mobile platforms in no time. With Unity 2020, this state-of-the-art game engine introduces enhancements in Unity tooling, editor, and workflow, among many other additions.

The third edition of this Unity book is updated to the new features in Unity 2020 and modern game development practices. Once you've quickly got to grips with the fundamentals of Unity game development, you'll create a collection, a twin-stick shooter, and a 2D adventure game. You'll then explore advanced topics such as machine learning, virtual reality, and augmented reality by building complete projects using the latest game tool kit. As you implement concepts in practice, this book will ensure that you come away with a clear understanding of Unity game development.

By the end of the book, you'll have a firm foundation in Unity development using C#, which can be applied to other engines and programming languages. You'll also be able to create several real-world projects to add to your professional game development portfolio.

What you will learn

  • Learn the fundamentals of game development, including GameObjects, components, and scenes
  • Develop a variety of games in C# and explore the brand new sprite shaping tool for Unity 3D and 2D games
  • Handle player controls and input functionality for your Unity games
  • Implement AI techniques such as pathfinding, finite state machines, and machine learning using Unity ML-Agents
  • Create virtual and augmented reality games using UnityVR and AR Foundation
  • Explore the cutting-edge features of Unity 2020 and how they can be used to improve your games

Who this book is for

If you are a game developer or programmer new to Unity and want to get up and running with the game engine in a hands-on way, this book is for you. Unity developers looking to work on practical projects to explore new features in Unity 2020 will find this book useful. A basic understanding of C# programming is required.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Unity 2020 By Example als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Unity 2020 By Example von Robert Wells im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Informatique & Programmation de jeux. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2020
ISBN
9781800200784

Chapter 1: Exploring the Fundamentals of Unity

Unity is a game engine that works with your existing asset pipeline (such as 3D modeling software) and can be used to compile video games that work seamlessly across multiple platforms and devices, including Windows, Mac, Linux, Android, and iOS. 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 according to a unified logic. This book focuses on developing games in Unity 2020 — taking you step by step through how to create increasingly complex projects.
This chapter starts the first project on our list, which will be a fun collection game. By the end of the next chapter, you'll have pieced together a simple but complete game. As part of the process, you'll become familiar with the fundamentals of developing in Unity, including the following:
  • New features in Unity 2020
  • Creating new projects using Unity Hub
  • How to navigate the Unity editor
  • Unity project structure
  • Importing assets using the Package Manager
  • Using the Unity editor to create a level
  • Creating optimized lighting effects
  • How to playtest the game
Using the information in this chapter, you will gain an understanding of how to create new projects from scratch, navigate the Unity editor, and import assets, information that will be invaluable for years to come as you develop your own projects in Unity.
Remember, it doesn't matter if you've never used Unity before. We'll go through everything that is required step by step, starting with the new features found in Unity 2020.

Technical requirements

This book is about Unity and developing games in that engine. The basics of programming as a subject is, however, beyond the scope of this book. So, I'll assume that you already have a working knowledge of coding generally but have not coded in Unity before.
You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Unity-2020-By-Example.
Once downloaded, you can find the CollectionGame project in the Chapter01/End folder.

Exploring new features in Unity 2020

Before we start our first project, let's take a moment to look at the new features introduced since the previous edition of this book. We'll cover all of these, and much more!
Starting with Unity Hub, while not technically part of Unity 2020 (it is a separate application), it makes it easy to manage multiple Unity projects and versions. I will guide you through creating a new project using Unity Hub in this chapter. Once an empty project has been created, we will import assets using the new Package Manager — an easy way to manage a project's assets (more on this shortly).
In the world of 2D, a new tool called Sprite Shape will help us create more dynamic and flexible environments from within the Unity editor. Whether 2D or 3D, Artificial Intelligence (AI) is an ever-evolving field, and not to be left behind, Unity has introduced a new machine learning toolkit called ml-agents. This is an exciting new way to create intelligent agents (any dynamic non-playable character) in a game. Rather than defining exactly how an agent should act in every situation, we can provide the tools for the agent to learn how best to achieve their goals, whatever they may be.
It's an exciting time for Augmented Reality (AR), with the inclusion of ARFoundation in Unity, an AR toolkit, which we will use to blend reality and gaming. Lastly, we'll take a look at state of the art and investigate how we can optimize our games by using DOTs, a multi-threaded data-oriented technology stack. Don't worry if that sounds scary; it will all become clear as we progress through the book.
Now that we have an understanding of the some of the new topics covered in this book, let's design the first game we will implement in Unity 2020.

Introducing the first game

In the first game we will create, the player will control a character in the first person to explore an environment, collecting coins before a time limit runs out. If the timer runs out, the game is over. On the other hand, if all coins are collected before the timer expires, the player wins. The controls will use the industry-standard WASD keyboard setup, where W moves forward, A and S move left and right, and D walks backward. Head movement is controlled using the mouse, and coins are collected by colliding with them.
The benefit of developing this type of game is that it will demonstrate all the core Unity features, and we won't need to rely on any external software to make assets, such as textures, meshes, and materials.
See Figure 1.1, which features the coin collection game in action in the Unity Editor:
Figure 1.1 – The completed coin collection game
Figure 1.1 – The completed coin collection game
Important note
The completed CollectionGame project, as discussed in this chapter and the next, can be found in the book companion files in the Chapter02/End folder.
Now that we have an idea of the type of game we'll be making, in the next section, we can start development by creating the initial project structure.
Getting started with Unity
Every time you want to make a new Unity game, including coin collection games, you'll need to create a new project. Generally speaking, Unity uses the term project to mean a game. There are two main ways to make a new project, and it really doesn't matter which one you choose because both end up in the same place. If you're already in the Unity interface, looking at an existing scene or level, you can select File | New Project... from the application menu, as shown in Figure 1.2:
Figure 1.2 – Creating a new project via the main menu
Figure 1.2 – Creating a new project via the main menu
After selecting the New Project option, Unity leads you to the project creation wizard.
Alternatively, you can create a new project using Unity Hub, as shown in Figure 1.3. Unity Hub is a standalone application that you can use not only to manage your projects, but your Unity installations as well. So, if you want...

Inhaltsverzeichnis