Unity 2021 Cookbook - Fourth Edition: Over 140 recipes to take your Unity game development skills to the next level
Discover the latest features of Unity 2021 and dive deeper into the nuances of professional game development with Unity

Key Features

  • Discover the latest features of Unity 2021 including coverage of AR/VR development
  • Follow practical recipes for better 2D and 2D character development with Unity GameKits
  • Learn powerful techniques and expert best practices in building 3D objects, textures, and materials

Book Description

If you are a Unity developer looking to explore the newest features of Unity 2021 and recipes for advanced challenges, then this fourth edition of Unity Cookbook is here to help you. With this cookbook, you’ll work through a wide variety of recipes that will help you use the essential features of the Unity game engine to their fullest potential. You familiarize yourself with shaders and Shader Graph before exploring animation features to enhance your skills in building games. As you progress, you will gain insights into Unity's latest editor, which will help you in laying out scenes, tweaking existing apps, and building custom tools for augmented reality and virtual reality (AR/VR) experiences. The book will also guide you through many Unity C# gameplay scripting techniques, teaching you how to communicate with database-driven websites and process XML and JSON data files. By the end of this Unity book, you will have gained a comprehensive understanding of Unity game development and built your development skills. The easy-to-follow recipes will earn a permanent place on your bookshelf for reference and help you build better games that stay true to your vision.

What you will learn

  • Discover how to add core game features to your projects with C# scripting
  • Create powerful and stylish UI with Unity's UI system, including power bars, radars, and button-driven scene changes
  • Work with essential audio features, including background music and sound effects
  • Discover Cinemachine in Unity to intelligently control camera movements
  • Add visual effects such as smoke and explosions by creating and customizing particle systems
  • Understand how to build your own Shaders with the Shader Graph tool

Who this book is for

If you’re a Unity developer looking for better ways to resolve common recurring problems with recipes, then this book is for you. Programmers dipping their toes into multimedia features for the first time will also find this book useful. Before you get started with this Unity engine book, you’ll need a solid understanding of Unity’s functionality and experience with programming in C#.

1140779683
Unity 2021 Cookbook - Fourth Edition: Over 140 recipes to take your Unity game development skills to the next level
Discover the latest features of Unity 2021 and dive deeper into the nuances of professional game development with Unity

Key Features

  • Discover the latest features of Unity 2021 including coverage of AR/VR development
  • Follow practical recipes for better 2D and 2D character development with Unity GameKits
  • Learn powerful techniques and expert best practices in building 3D objects, textures, and materials

Book Description

If you are a Unity developer looking to explore the newest features of Unity 2021 and recipes for advanced challenges, then this fourth edition of Unity Cookbook is here to help you. With this cookbook, you’ll work through a wide variety of recipes that will help you use the essential features of the Unity game engine to their fullest potential. You familiarize yourself with shaders and Shader Graph before exploring animation features to enhance your skills in building games. As you progress, you will gain insights into Unity's latest editor, which will help you in laying out scenes, tweaking existing apps, and building custom tools for augmented reality and virtual reality (AR/VR) experiences. The book will also guide you through many Unity C# gameplay scripting techniques, teaching you how to communicate with database-driven websites and process XML and JSON data files. By the end of this Unity book, you will have gained a comprehensive understanding of Unity game development and built your development skills. The easy-to-follow recipes will earn a permanent place on your bookshelf for reference and help you build better games that stay true to your vision.

What you will learn

  • Discover how to add core game features to your projects with C# scripting
  • Create powerful and stylish UI with Unity's UI system, including power bars, radars, and button-driven scene changes
  • Work with essential audio features, including background music and sound effects
  • Discover Cinemachine in Unity to intelligently control camera movements
  • Add visual effects such as smoke and explosions by creating and customizing particle systems
  • Understand how to build your own Shaders with the Shader Graph tool

Who this book is for

If you’re a Unity developer looking for better ways to resolve common recurring problems with recipes, then this book is for you. Programmers dipping their toes into multimedia features for the first time will also find this book useful. Before you get started with this Unity engine book, you’ll need a solid understanding of Unity’s functionality and experience with programming in C#.

54.99 In Stock
Unity 2021 Cookbook - Fourth Edition: Over 140 recipes to take your Unity game development skills to the next level

Unity 2021 Cookbook - Fourth Edition: Over 140 recipes to take your Unity game development skills to the next level

Unity 2021 Cookbook - Fourth Edition: Over 140 recipes to take your Unity game development skills to the next level

Unity 2021 Cookbook - Fourth Edition: Over 140 recipes to take your Unity game development skills to the next level

Paperback(4th ed.)

$54.99 
  • SHIP THIS ITEM
    In stock. Ships in 1-2 days.
  • PICK UP IN STORE

    Your local store may have stock of this item.

Related collections and offers


Overview

Discover the latest features of Unity 2021 and dive deeper into the nuances of professional game development with Unity

Key Features

  • Discover the latest features of Unity 2021 including coverage of AR/VR development
  • Follow practical recipes for better 2D and 2D character development with Unity GameKits
  • Learn powerful techniques and expert best practices in building 3D objects, textures, and materials

Book Description

If you are a Unity developer looking to explore the newest features of Unity 2021 and recipes for advanced challenges, then this fourth edition of Unity Cookbook is here to help you. With this cookbook, you’ll work through a wide variety of recipes that will help you use the essential features of the Unity game engine to their fullest potential. You familiarize yourself with shaders and Shader Graph before exploring animation features to enhance your skills in building games. As you progress, you will gain insights into Unity's latest editor, which will help you in laying out scenes, tweaking existing apps, and building custom tools for augmented reality and virtual reality (AR/VR) experiences. The book will also guide you through many Unity C# gameplay scripting techniques, teaching you how to communicate with database-driven websites and process XML and JSON data files. By the end of this Unity book, you will have gained a comprehensive understanding of Unity game development and built your development skills. The easy-to-follow recipes will earn a permanent place on your bookshelf for reference and help you build better games that stay true to your vision.

What you will learn

  • Discover how to add core game features to your projects with C# scripting
  • Create powerful and stylish UI with Unity's UI system, including power bars, radars, and button-driven scene changes
  • Work with essential audio features, including background music and sound effects
  • Discover Cinemachine in Unity to intelligently control camera movements
  • Add visual effects such as smoke and explosions by creating and customizing particle systems
  • Understand how to build your own Shaders with the Shader Graph tool

Who this book is for

If you’re a Unity developer looking for better ways to resolve common recurring problems with recipes, then this book is for you. Programmers dipping their toes into multimedia features for the first time will also find this book useful. Before you get started with this Unity engine book, you’ll need a solid understanding of Unity’s functionality and experience with programming in C#.


Product Details

ISBN-13: 9781839217616
Publisher: Packt Publishing
Publication date: 09/03/2021
Edition description: 4th ed.
Pages: 816
Product dimensions: 7.50(w) x 9.25(h) x 1.62(d)

About the Author

Matt Smith is computing academic at TUDublin (Technological University of Dublin) Ireland, where he leads the DRIVE Research Group (Digital Realities, Interaction, and Virtual Environments). Matt started computer programming on a brand new ZX80 and submitted 2 games for his computing O-level exam. After nearly 10 years as a full-time student on a succession of scholarships, he gained several degrees in computing, including a Ph.D. in computational musicology. In 1985, Matt wrote the lyrics and was in the band whose music appeared on the audio cassette carrying the computer game Confuzion. Matt is a documentation author for the open-source Unity Fungus visual scripting and dialogue system.

Shaun is a lecturer at Technological University Dublin. He is currently teaching on the BA (Hons) in Creative Digital Media where he is lead in the delivery of the Multimedia Stream. He is currently exploring serious games for construction-related training as well as the opportunities transmedia provides in improving user experience and engagement in cultural archive artifacts. His educational research is currently driven by his interest in self-determined learning (heutagogy), rhizomatic learning theory, micro-credentialing /digital badging, and curriculum development.

Table of Contents

Preface 1

Chapter 1 Displaying Data with Core UI Elements 9

Technical requirements 14

Displaying a "Hello World" UI text message 14

Displaying a digital clock 19

Displaying a digital countdown timer 23

Creating a message that fades away 26

Displaying a perspective 3D Text Mesh 28

Creating sophisticated text with TextMeshPro 32

Displaying an image 35

Creating UIs with the Fungus open source dialog system 39

Creating a Fungus character dialog with images 42

Further reading 46

Chapter 2 Responding to User Events for Interactive UIs 47

Technical requirements 51

Creating UI Buttons to move between scenes 51

Animating button properties on mouseover 56

Organizing image panels and changing panel depths via buttons 59

Displaying the value of an interactive UI Slider 63

Displaying a countdown timer graphically with a UI Slider 68

Setting custom mouse cursors for 2D and 3D GameObjects 72

Setting custom mouse cursors for UI controls 75

Interactive text entry with Input Field 77

Toggles and radio buttons via toggle groups 80

Creating text and image icon UI Drop-down menus 86

Displaying a radar to indicate the relative locations of objects 91

Chapter 3 Inventory and Advanced UIs 103

Technical requirements 105

Creating a simple 2D mini-game - SpaceGirl 106

Displaying single object pickups with carrying and not-carrying text 111

Displaying single-object pickups with carrying and not-carrying icons 120

Displaying multiple pickups of the same object with multiple status icons 124

Using panels to visually outline the inventory UI area and individual items 132

Creating a C# inventory slot UI to display scripted components 137

Using UI Grid Layout Groups to automatically populate a panel 147

Displaying multiple pickups of different objects as a fist of text via a dynamic list of scripted PickUp objects 158

Using a Dictionary and Enums to display text totals for different objects 165

Creating a runtime UI Toolkit interface 171

Further reading 177

Chapter 4 Playing and Manipulating Sounds 179

Technical requirements 180

Playing different one-off sound effects with a single AudioSource component 181

Playing and controlling different sounds each with its own AudioSource component 184

Creating just-in-time AudioSource components at runtime through C# scripting 186

Delaying before playing a sound 191

Preventing an audio clip from restarting if it is already playing 193

Waiting for the audio to finish playing before auto-destructing an object 195

Scheduling a sound to play at a certain time 199

Audio visualization from sample spectral data 205

Synchronizing simultaneous and sequential music to create a simple 140 bpm music-loop manager 210

Further reading 215

Chapter 5 Creating 3D Objects, Terrains, Textures, and Materials 217

Technical requirements 218

Creating 3D primitives and adding materials and textures 218

Converting and importing 3D models into a project 226

Highlighting GameObject materials on mouseover 231

Fading the transparency of a material 237

Creating geometry with ProBuilder 245

Creating a house with ProBuilder 251

Creating and texture-painting terrains 256

Height painting terrains 261

Adding Terrain holes 265

Further reading 269

Chapter 6 2D Animation and Physics 271

Technical requirements 273

Flipping a sprite horizontally - the DIY approach 273

Flipping a sprite horizontally - using Animator State Chart and transitions 276

Animating body parts for character movement events 284

Creating a three-frame animation clip to make a platform continually animate 293

Making a platform start falling once stepped on using a Trigger to move the animation from one state to another 296

Creating animation clips from sprite sheet sequences 302

Creating a platform game with tiles and tilemaps 306

Using sprite placeholders to create a simple physics scene 312

Editing polygon Colliders for more realistic 2D physics 317

Creating an explosionForce method for 2D physics objects 320

Clipping via Sprite Masking 325

Further reading 329

Chapter 7 Characters, GameKits, and Starter Assets 331

Technical requirements 332

Creating a game with the 3D Game Kit 332

Creating a game with the 2D Game Kit 342

Importing third-party 3D models and animations from Mixamo 347

Swapping the Standard Assets Ethan for a different character 352

Importing a 3D model and adding an Animation Controller 358

Using scripts to control 3D animations 363

Importing and using a UMA free character 371

Getting started with the 2021 Starter Assets package 378

Further reading 380

Chapter 8 Web Server Communication and Online Version Control 383

Technical requirements 384

Setting up a leaderboard using PHP and a database 385

Unity game communication with a web server leaderboard 390

Creating and cloning a GitHub repository 394

Adding a Unity project to a local Git repository, and pushing files up to GitHub 403

Unity project version control using GitHub for Unity 406

Further reading 414

Chapter 9 Controlling and Choosing Positions 415

Technical requirements 417

Using a rectangle to constrain 2D Player object movement 417

Player control of a 3D GameObject (and limiting movement within a rectangle) 423

Choosing destinations - finding a random spawn point 431

Choosing destinations - finding the nearest spawn point 435

Choosing destinations - respawning to the most recently passed checkpoint 438

Moving objects by clicking on them 441

Firing projectiles in the direction of movement 443

Chapter 10 Navigation Meshes and Agents 449

Technical requirements 451

NPC to travel to destination while avoiding obstacles 451

NPC to seek or flee from a moving object 457

Point-and-click move to object 464

Point-and-click move to tile 467

Point-and-click raycast with user-defined, higher-cost navigation areas 470

NPC NavMeshAgent to follow waypoints in a sequence 477

Controlling object group movement through flocking 485

Creating a movable NavMesh Obstacle 491

Further reading 493

Chapter 11 Cameras and Rendering Pipelines 495

Technical requirements 497

Creating the basic scene for this chapter 498

Working with a fixed Main Camera 501

Changing how much of the screen a camera renders to 504

Using Render Textures to send camera output to places other than the screen 511

Working with Unity's multipurpose camera rig 517

Using Cinemachine ClearShot to switch cameras to keep the player in shot 519

Letting the player switch to a Cinemachine FreeLook camera 524

Creating a project with the URP 527

Adding a vignette effect 530

Creating an HDRP project with an HDRI skybox 534

Further reading 537

Chapter 12 Shader Graphs and Video Players 539

Technical requirements 541

Playing videos by manually adding a VideoPlayer component to a GameObject 542

Using scripting to control video playback on scene textures 544

Ensuring a movie is prepared before playing 549

Outputting video playback to a RenderTexture asset 553

Using scripting to play a sequence of videos back to back 555

Creating and using a simple Shader Graph 562

Creating a glow effect with Shader Graph 566

Toggling a Shader Graph color glow effect through C# code 572

Further reading 576

Chapter 13 Advanced Topics - Gizmos, Automated Testing, and More 577

Technical requirements 582

Using Gizmo to show the currently selected object in the Scene window 582

Creating an editor snap-to-grid drawn by a Gizmo 584

Saving and loading player data - using static properties 594

Saving and loading player data - using PlayerPrefs 598

Loading game data from a text file map 600

Saving data to a file while the game is running 608

Generating and running a default test script class 611

A simple unit test 615

Parameterizing tests with a data provider 618

Unit testing a simple health script class 620

Creating and executing a unit test in PlayMode 628

PlayMode testing a door animation 631

PlayMode and unit testing a player health bar with events, logging, and exceptions 637

Reporting Code Coverage testing 650

Running simple Python scripts inside Unity 653

Further reading 657

Chapter 14 Particle Systems and Other Visual Effects 659

Technical requirements 663

Exploring Unity's Particle Pack and reusing samples for your own games 663

Creating a simple particle system from scratch 667

Using Texture Sheets to simulate fire with a particle system 676

Making particles collide with scene objects 680

Simulating an explosion 686

Using Invoke to delay the execution of an explosion 693

Further reading 699

Chapter 15 Virtual and Augmented Reality (VR/AR) 701

Technical requirements 707

Setting up Unity for VR 708

Setting up an Oculus Quest/2 in Developer Mode 713

Creating a VR project for the Oculus Quest/2 716

Creating a VR project using the Mock HMD device 728

Working with the Mozilla demo WebXR project 733

Adding 360-degree videos to a VR project 744

Exploring the Unity AR samples 750

Setting up Unity for AR 758

Creating a simple AR Foundation project 766

Detecting and highlighting planes with AR Foundation 770

Creating an AR furniture previewer by detecting horizontal planes 774

Creating a floating 3D model over an image target 779

Further reading 783

Index

From the B&N Reads Blog

Customer Reviews