Book description
Learn everything you need to know to use the powerful Unity engine to its full potential for 3D and 2D game development, simulation, artificial intelligence, and beyond. From the basics of scripting to techniques for interactivity, AI and behavior, animation, narrative, and networking, this flexible, mind-bogglingly popular engine is useful for anything that needs visuals and real-time simulation.
With this thoroughly updated problem-solving cookbook, beginner and intermediate Unity developers will learn about the Unity engine through brief recipes that teach specific features of the software and scripting systems. You'll apply a collection of snippets of code to address common scenarios such as properly keeping score, accepting input, and sharing state over the network.
This cookbook pinpoints the problem, sets out the solution, and discusses how to solve your problem in the best and most straightforward way possible. You'll find solutions for:
- 2D and 3D graphics
- Math, physics, and character control
- Animation and movement
- Behavior and AI
- Sound and music
- Narrative and dialogue
- Input and gameplay
- Scripting and user interface
- Simulation and synthetic data creation
- Networking and accessing web content
- Analytics and telemetry
Publisher resources
Table of contents
- Preface
- 1. Working in Unity
-
2. Scripting
- 2.1. Adding a Script to an Object in a Unity Scene
- 2.2. Running Code at Specific Times in a Script’s (or Game Object’s) Life
- 2.3. Creating Frame Rate–Independent Behavior
- 2.4. Using the Components of a Game Object
- 2.5. Finding Objects Attached to a Game Object
- 2.6. Singletons
- 2.7. Using Coroutines to Manage When Code Runs
- 2.8. Managing Objects Using an Object Pool
- 2.9. Storing Data in Assets Using ScriptableObject
- 3. Input
- 4. Mathematics
-
5. 2D Graphics
- 5.1. Importing Images as Sprites
- 5.2. Adding a Sprite to the Scene
- 5.3. Creating a Sprite Animation
- 5.4. Creating a Sprite with 2D Physics
- 5.5. Customizing Sprite Collision Shapes
- 5.6. Using a Composite Collider
- 5.7. Using the Sprite Packer
- 5.8. Applying Forces to 2D Objects
- 5.9. Creating a Conveyor Belt
- 5.10. Using a Custom Material for Sprites
- 5.11. Managing Sprite Sorting
- 5.12. Using Sorting Groups
- 5.13. Creating a 2.5D Scene
-
6. 3D Graphics
- 6.1. Creating a Simple Material
- 6.2. Controlling a Material’s Property Through a Script
- 6.3. Creating an Unlit Material
- 6.4. Setting Up a Material Using Textures
- 6.5. Making a Material Use a Shader
- 6.6. Setting Up a Bloom Effect Using Post-Processing with the Built-In Render Pipeline
- 6.7. Setting Up a Bloom Effect Using Post-Processing with the Universal Render Pipeline
- 6.8. Using High-Dynamic-Range Colors
- 6.9. Setting Up a Project to Use a Scriptable Render Pipeline
- 6.10. Creating a Shader Using the Shader Graph
- 6.11. Creating a Glowing Effect Using the Shader Graph
- 6.12. Exposing Properties from a Shader Graph
- 6.13. Animating a Shader over Time
- 6.14. Controlling the Speed of an Animated Shader
- 6.15. Using a Subgraph to Reuse Graph Components
- 6.16. Implementing a Dissolve Effect Using a Shader Graph
- 6.17. Using Baked Lighting and Real-Time Lighting
- 6.18. Using Baked Emission Sources
- 6.19. Making Static Objects Cast Shadows on Dynamic Objects
- 6.20. Using Light Probes to Influence Lighting
- 6.21. Using Reflection Probes
- 6.22. Faking a Dynamic Emissive Object
- 6.23. Rendering to a Texture
-
7. 3D Physics and Character Control
- 7.1. Running Code a Specific Number of Times per Second
- 7.2. Allowing the Player to Look Around Using the Mouse
- 7.3. Controlling a 3D Character
- 7.4. Interacting with Switches and Objects
- 7.5. Picking Up and Putting Down Objects
- 7.6. Detecting When an Object Is Touching Another Object
- 7.7. Detecting When an Object Is in a Trigger Area
- 7.8. Implementing Moving Platforms
- 7.9. Implementing Platform Riding
- 7.10. Responding to Being Pushed by Objects
- 8. Animation and Movement
-
9. Logic and Gameplay
- 9.1. Loading a New Scene File
- 9.2. Managing Hit Points
- 9.3. Creating a Top-Down Camera
- 9.4. Managing Quests
- 9.5. Dragging a Box to Select Objects
- 9.6. Creating a Menu Structure
- 9.7. Creating a Wheeled Vehicle
- 9.8. Keeping a Car from Tipping Over
- 9.9. Creating Speed Boosts
- 9.10. Creating a Camera That Orbits Around Its Target
- 9.11. Creating an Orbiting Camera That Won’t Clip Through Walls
- 9.12. Detecting When the Player Has Completed a Lap
-
10. Behavior, Simulation, and AI
- 10.1. Enemies Detecting When They Can See the Player
- 10.2. Defining a Path That AI Entities and the Player Can Follow
- 10.3. Letting Entities in Your Game Follow a Path
- 10.4. Finding a Good Distribution of Random Points (Poisson Disc)
- 10.5. Enemies Detecting Where They Can Take Cover
- 10.6. Building and Using a State Machine
- 10.7. Building a Simulation Environment for Machine Learning
- 11. Sound and Music
- 12. User Interface
- 13. Files, Networking, and Screenshots
- Index
- About the Authors
Product information
- Title: Unity Development Cookbook, 2nd Edition
- Author(s):
- Release date: August 2023
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781098113711
You might also like
book
Unity Game Development Cookbook
Discover how to use the Unity game engine to its full potential for both 3D and …
book
Unity in Action, Second Edition
Manning's bestselling and highly recommended Unity book has been fully revised! Unity in Action, Second Edition …
book
Unity in Action, Third Edition
This hands-on beginners guide gets you building games fast, all with the awesome Unity engine! You’ll …
book
Unity Cookbook - Fifth Edition
Are you ready to take your Unity game development skills to the next level? Look no …