Hands-On Unity 2022 Game Development - Third Edition

Book description

Create, customize, and optimize your own professional games from scratch with Unity 2022

Includes invitation to join the online Unity Game Development community to read the book alongside Unity developers/C# programmers and Nicolas Borromeo.

Purchase of the print or Kindle book includes a free eBook in PDF format.

Key Features

  • Create the game prototype and learn the fundamentals of Unity editor to build scenes, objects and import objects
  • Add interactivity, win/lose conditions, sound, graphics and artificial intelligence using C# and visual scripting
  • Improve the game graphics, user interface, add visual effects and animations using Animator, Cinemachine, and Timeline

Book Description

Unity is a cross-platform game engine that provides you with powerful but simple-to-use features to solve the most common problems in Game Development, such as rendering, animation, physics, sound, and effects. You'll learn to use these features to create simple but complete games (and all the nuances needed to handle Unity).

Complete with hands-on tutorials and projects, this book will teach you to use the Unity game engine, create C# and visual scripts, integrate graphics, sound, and animations, and manipulate physics to create interesting mechanics for your game. You'll then code a simple AI agent to challenge the user and work with profiling tools to ensure code efficiency.

Finally, you'll work with Unity's AR tools to create AR experiences for 3D apps and games before publishing them to the world.

If you are interested in creating impressive, commercial-quality games that are playable on a variety of platforms, then you've come to the right place.

What you will learn

  • Build a game prototype that includes gameplay, player and non-player characters, assets, animations, and more
  • Set up and navigate the game engine to dive into the Unity Editor and discover unique and new features released in 2022
  • Learn both C# and Visual Scripting to customize player movements, the user interface, and game physics
  • Apply shaders to improve your game graphics using Shader Graph and Universal Render Pipeline (URP)
  • Create win-lose conditions for the game by using design patterns such as Singleton and Event Listeners
  • Implement Game AI to build a fully functional enemy capable of detecting and attacking the player
  • Debug, test, optimize, and create an executable version of the game to share with your friends

Who this book is for

Both game and non-game developers who wish to migrate or start building 3D games in Unity will find this book useful. While you'll still able to follow along if you don't have any programming experience, knowing the fundamentals of C# programming will help you get the most out of this book.

Table of contents

  1. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Get in touch
    5. Share your thoughts
  2. Creating a Unity Project
    1. Installing Unity
      1. Unity’s technical requirements
      2. Unity versioning
      3. Installing Unity with Unity Hub
    2. Creating projects
      1. Creating a project
      2. Project structure
    3. Summary
  3. Editing Scenes and Game Objects
    1. Manipulating scenes
      1. The purpose of a scene
      2. The Scene View
      3. Adding our first GameObject to the scene
      4. Navigating the Scene View
      5. Manipulating GameObjects
    2. GameObjects and components
      1. Understanding 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
    6. Summary
  4. Grayboxing with Terrain and ProBuilder
    1. Defining our game concept
    2. Creating a landscape with Terrain
      1. Discussing Height Maps
      2. Creating and configuring Height Maps
      3. Authoring Height Maps
      4. Adding Height Map details
    3. Creating shapes with ProBuilder
      1. Installing ProBuilder
      2. Creating a shape
      3. Manipulating the mesh
      4. Adding details
    4. Summary
  5. Importing and Integrating Assets
    1. Importing assets
      1. Importing assets from the internet
      2. Importing assets from the Asset Store
      3. Importing assets from Unity Packages
    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
  6. Introduction to C# and Visual Scripting
    1. Creating scripts
      1. Initial setup
      2. Creating a C# script
      3. Adding fields
      4. Creating a Visual Script
    2. Using events and instructions
      1. Events and instructions in C#
      2. Events and instructions in Visual Scripting
      3. Using fields in instructions
      4. Common beginner C# script errors
    3. Summary
  7. 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. Using the new Input System
      1. Installing the new Input System
      2. Creating Input Mappings
      3. Using Mappings in our scripts
    4. Summary
  8. 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
  9. Win and Lose Conditions
    1. Creating object managers
      1. Sharing variables with the Singleton design pattern
      2. Sharing variables with Visual Scripting
      3. Creating managers
    2. Creating Game Modes
    3. Improving our code with events
    4. Summary
  10. Implementing Game AI for Building Enemies
    1. Gathering information with sensors
      1. Creating three-filter sensors with C#
      2. Creating Three-Filters sensors with Visual Scripting
      3. Debugging with gizmos
    2. Making decisions with FSMs
      1. Creating the FSM in C#
      2. Creating transitions
      3. Creating the FSM in Visual Scripting
    3. Executing FSM actions
      1. Calculating our scene’s NavMesh
      2. Using Pathfinding
    4. Adding the final details
    5. Summary
  11. Materials and Effects with URP and Shader Graph
    1. Introducing shaders and URP
      1. Shader Pipeline
      2. Render Pipeline and URP
      3. URP built-in shaders
    2. Creating shaders with Shader Graph
      1. Creating our first Shader Graph
    3. Using Textures
    4. Combining Textures
    5. Applying transparency
    6. Creating Vertex Effects
    7. Summary
  12. Visual Effects with Particle Systems and Visual Effect Graph
    1. Introduction to Shuriken particle systems
      1. Creating a basic particle system with Shuriken
      2. Using advanced modules
    2. Creating fluid simulations
      1. Creating a waterfall effect
      2. Creating a bonfire effect
    3. Creating complex simulations with Visual Effect Graph
      1. Installing Visual Effect Graph
      2. Creating and analyzing a Visual Effect Graph
      3. Creating a rain effect
    4. Scripting Visual Effects
    5. Summary
  13. 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
  14. Full-Screen Effects with Post-Processing
    1. Using post-processing
      1. Setting up a profile
      2. Using basic effects
    2. Using advanced effects
      1. High Dynamic Range (HDR) and Depth Map
      2. Applying advanced effects
    3. Summary
  15. 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. Scripting audio feedback
    4. Summary
  16. User Interface Design
    1. Understanding the Canvas and RectTransform
      1. Creating a UI with the Canvas
      2. Positioning elements with RectTransform
    2. Canvas object types
      1. Integrating assets for the UI
      2. Creating UI controls
    3. Creating a responsive UI
      1. Adapting object positions
      2. Adapting object sizes
    4. Scripting the UI
      1. Showing information in the UI
      2. Programming the Pause menu
    5. Summary
  17. Creating a UI with the UI Toolkit
    1. Why learn UI Toolkit?
    2. Creating a UI with UI Toolkit
      1. Creating UI Documents
      2. Editing UI Documents
      3. Creating UI Stylesheets
    3. Making a responsive UI
      1. Dynamic positioning and sizing
      2. Dynamic scaling
      3. Using relative positions
    4. Summary
  18. Creating Animations with Animator, Cinemachine, and Timeline
    1. Using Skinning Animation with Animator
      1. Understanding skinning
      2. Importing skeletal animations
      3. Integration using Animation Controllers
      4. Using Avatar Masks
    2. Scripting animations
      1. Scripting player shooting animations
      2. Scripting movement animations
    3. Creating dynamic cameras with Cinemachine
      1. Creating camera behaviors
      2. Creating dolly tracks
    4. Creating cutscenes with Timeline
      1. Creating animation clips
      2. Sequencing our intro cutscene
    5. Summary
  19. Optimization with Profiler, Frame Debugger, and Memory Profiler
    1. Optimizing graphics
      1. Introduction to graphics 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
  20. Generating and Debugging an Executable
    1. Building a project
    2. Debugging the build
      1. Debugging code
      2. Profiling performance
    3. Summary
  21. 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
  22. Other Books You May Enjoy
  23. Index

Product information

  • Title: Hands-On Unity 2022 Game Development - Third Edition
  • Author(s): Nicolas Alejandro Borromeo
  • Release date: October 2022
  • Publisher(s): Packt Publishing
  • ISBN: 9781803236919