Hands-On Unity 2020 Game Development

Book description

Build immersive game experiences using the new Unity 2020 features with this practical guide

Key Features

  • Unleash the capabilities of C# scripting for creating immersive UI, graphics, Game AI agents and much more
  • Explore Unity's latest tools, including Universal Render Pipeline, Shader Graph, and VFX graph, to enhance graphics and animation
  • Get started with building augmented reality experience using Unity's AR Foundation

Book Description

Over the years, the Unity game engine has extended its scope from just being about creating video games to building AR/VR experiences, complex simulations, real-time realistic rendering, films, and serious games for training and education. Its features for implementing gameplay, graphics, and customization using C# programming make Unity a comprehensive platform for developing professional-level, rich experiences.

With this book, you'll be able to build impressive Unity projects in a step-by-step manner and apply your knowledge of Unity concepts to create a real-world game. Complete with hands-on tutorials and projects, this easy-to-follow guide will show you how to develop your first complete game using a variety of Unity tools. As you make progress, you'll learn how to make the most of the Unity Editor and create scripts using the C# programming language. This Unity game development book will then take you through integrating graphics, sound, and animations and manipulating physics to create impressive mechanics for your games. You'll also learn how to code a simple AI agent to challenge the user and use profiling tools to ensure that the code runs in a performant way. Finally, you'll get to grips with Unity's AR Foundation for creating AR experiences for 3D apps and games.

By the end of this book, you'll have developed a complete game and will have built a solid foundation using Unity's tooling ecosystem to develop game projects of any scale.

What you will learn

  • Write scripts for customizing various aspects of a game, such as physics, gameplay, and UI
  • Program rich shaders and effects using Unity's new Shader Graph and Universal Render Pipeline
  • Implement postprocessing to increase graphics quality with full-screen effects
  • Create rich particle systems for your Unity games from scratch using VFX Graph and Shuriken
  • Add animations to your game using the Animator, Cinemachine, and Timeline
  • Implement game artificial intelligence (AI) to control character behavior
  • Detect and fix optimization issues using profilers and batching

Who this book is for

This book is for game developers looking to migrate to the Unity game engine. If you are a developer with some exposure to Unity, this book will help you explore its latest features. Prior experience with C# programming is required to get the most out of the book.

Table of contents

  1. Hands-On Unity 2020 Game Development
  2. Why subscribe?
  3. Contributors
  4. About the author
  5. About the reviewer
  6. Packt is searching for authors like you
  7. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  8. Chapter 1: Designing a Game from Scratch
    1. Game concept
      1. Input controls
      2. Winning and losing
    2. Game characters
      1. Hero
      2. Enemies
    3. Gameplay
      1. Game-world layout
      2. Starting condition
      3. Ending condition
      4. Point system
      5. HUD
    4. The difficulty balance
      1. Difficulty balance questions
      2. Implementation plan
    5. Documentation
      1. Game Design Document (GDD)
      2. GDD formats
      3. GDD creation tools
      4. Elevator pitch
      5. A high concept
      6. Tips for creating GDDs
    6. Summary
  9. Chapter 2: Setting Up Unity
    1. Why use a game engine such as Unity?
      1. Past and present industry insight
      2. Game engines
      3. Positives of Unity
    2. Installing Unity
      1. Unity versions
      2. Installing Unity with Unity Hub
    3. Creating projects
      1. Creating a project
      2. Project structure
    4. Summary
  10. Chapter 3: Working with Scenes and GameObjects
    1. Manipulating scenes
      1. The purpose of a scene
      2. The Scene View
      3. Our first GameObject
      4. Navigating the Scene View
      5. Manipulating GameObjects
    2. GameObjects and components
      1. Components
      2. Manipulating components
    3. Object hierarchies
      1. Parenting of objects
      2. Possible uses
    4. Prefabs
      1. Creating Prefabs
      2. Prefab-instance relationship
      3. Prefab variants
    5. Saving scenes and projects
      1. Saving our changes
      2. Project structure
    6. Summary
  11. Chapter 4: Grayboxing with Terrain and ProBuilder
    1. Creating a Landscape with Terrain
      1. Discussing Height Maps
      2. Creating and configuring Height Maps
      3. Authoring Height Maps
      4. Adding Height Map details
    2. Creating Shapes with ProBuilder
      1. Installing ProBuilder
      2. Creating a Shape
      3. Manipulating the mesh
      4. Adding details
    3. Summary
  12. Chapter 5: Importing and Integrating Assets
    1. Importing assets
      1. Importing assets from the internet
      2. Importing assets from the Asset Store
    2. Integrating assets
      1. Integrating terrain textures
      2. Integrating meshes
      3. Integrating textures
    3. Configuring assets
      1. Configuring meshes
      2. Configuring textures
      3. Assembling the scene
    4. Summary
  13. Chapter 6: Materials and Effects with URP and Shader Graph
    1. Introducing Shaders
      1. Shader Pipeline
      2. Render Pipelines and URP
      3. URP Built-in Shaders
    2. Creating Shaders with Shader Graph
      1. Creating our first Shader Graph asset
    3. Using Textures
    4. Combining Textures
    5. Applying transparency
    6. Summary
  14. Chapter 7: Visual Effects with Particle Systems and VFX Graph
    1. Introduction to particle systems
      1. Creating a basic particle system
      2. Using advanced modules
    2. Creating fluid simulations
      1. Creating a waterfall effect
      2. Creating a bonfire effect
    3. Creating complex simulations with VFX Graph
      1. Installing VFX Graph
      2. Creating and analyzing a VFX Graph
      3. Creating a rain effect
    4. Summary
  15. Chapter 8: Lighting Using the Universal Render Pipeline
    1. Applying lighting
      1. Discussing lighting methods
      2. Configuring ambient lighting with skyboxes
      3. Configuring lighting in URP
    2. Applying shadows
      1. Understanding shadow calculations
      2. Configuring performant shadows
    3. Optimizing lighting
      1. Understanding static lighting
      2. Baking lightmaps
      3. Applying static lighting to static objects
    4. Summary
  16. Chapter 9: Fullscreen Effects with postprocessing
    1. Using postprocessing
      1. Setting up a profile
      2. Using basic effects
    2. Using advanced effects
      1. Advanced effects
    3. Summary
  17. Chapter 10: Sound and Music Integration
    1. Importing audio
      1. Audio types
      2. Configuring import settings
    2. Integrating and mixing audio
      1. Using 2D and 3D AudioSources
      2. Using an Audio Mixer
    3. Summary
  18. Chapter 11: User Interface Design
    1. Understanding Canvas and RectTransform
      1. Creating a UI with Canvas
      2. Positioning elements with RectTransform
    2. Canvas objects types
      1. Integrating assets for the UI
      2. Creating UI controls
    3. Creating a responsive UI
      1. Adapting objects' positions
      2. Adapting objects' sizes
    4. Summary
  19. Chapter 12: Creating Animations with Animator, Cinemachine, and Timeline
    1. Using skeletal animations with Animator
      1. Understanding skinning
      2. Importing skeletal animations
      3. Integration using Animation Controllers
    2. Creating dynamic cameras with Cinemachine
      1. Creating dolly tracks
    3. Creating cutscenes with Timeline
      1. Creating animation clips
      2. Sequencing our intro cutscene
    4. Summary
  20. Chapter 13: Introduction to Unity Scripting with C#
    1. Creating C# scripts
      1. Initial setup
      2. Creating a MonoBehaviour-based class
      3. Adding fields
    2. Using events and instructions
      1. Events and instructions
      2. Using fields in instructions
      3. Common beginner errors
    3. Summary
  21. Chapter 14: Implementing Movement and Spawning
    1. Implementing movement
      1. Moving objects through Transform
      2. Using Input
      3. Understanding Delta Time
    2. Implementing spawning
      1. Spawning objects
      2. Timing actions
      3. Destroying objects
    3. Summary
  22. Chapter 15: Physics Collisions and Health System
    1. Configuring Physics
      1. Setting shapes
      2. Physics Object types
      3. Filtering collisions
    2. Detecting collisions
      1. Detecting Trigger events
      2. Modifying the other Object
    3. Moving with Physics
      1. Applying forces
      2. Tweaking Physics
    4. Summary
  23. Chapter 16: Win and Lose Conditions
    1. Creating Object Managers
      1. Implementing the Singleton design pattern
      2. Creating Managers with Singleton
    2. Creating Game Modes
    3. Improving our code with events
    4. Summary
  24. Chapter 17: Scripting the UI, Sounds, and Graphics
    1. Scripting the UI
      1. Showing information in the UI
      2. Programming the Pause menu
    2. Scripting feedback
      1. Scripting visual feedback
      2. Scripting audio feedback
      3. Scripting animations
    3. Summary
  25. Chapter 18: Implementing Game AI for Building Enemies
    1. Gathering information with sensors
      1. Creating Three-Filters sensors
      2. Debugging with Gizmos
    2. Making decisions with FSMs
      1. Creating the FSM
      2. Creating transitions
      3. Executing FSM actions
      4. Calculating our scene Pathfinding
      5. Using Pathfinding
    3. Adding final details
    4. Summary
  26. Chapter 19: Scene Performance Optimization
    1. Optimizing graphics
      1. Introduction to graphic engines
      2. Using Frame Debugger
      3. Using batching
      4. Other optimizations
    2. Optimizing processing
      1. Detecting CPU- and GPU-bound
      2. Using the CPU Usage profiler
      3. General CPU optimization techniques
    3. Optimizing memory
      1. Memory allocation and the garbage collector
      2. Using the Memory Profiler
    4. Summary
  27. Chapter 20: Building the Project
    1. Building a project
      1. Debugging the build
      2. Debugging code
      3. Profiling performance
    2. Summary
  28. Chapter 21: Finishing Touches
    1. Iterating your game
      1. Testing and feedback
      2. Interpreting feedback
    2. Releasing your game
      1. Pre-release
      2. Release
      3. Post-release
    3. Summary
  29. Chapter 22: Augmented Reality in Unity
    1. Using AR Foundation
      1. Creating an AR Foundation project
      2. Using tracking features
    2. Building for mobile devices
      1. Building for Android
      2. Building for iOS
    3. Creating a simple AR game
      1. Spawning the Player and Enemies
      2. Coding the Player and Enemy behavior
    4. Summary
  30. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Hands-On Unity 2020 Game Development
  • Author(s): Nicolas Alejandro Borromeo
  • Release date: July 2020
  • Publisher(s): Packt Publishing
  • ISBN: 9781838642006