Book description
Discover how to use the Unity game engine to its full potential for both 3D and 2D game development—from the basics of scripting to useful tricks in gameplay, behavior, and animation. With this problem-solving cookbook, you’ll get started in two ways:
First, you’ll learn about the Unity game engine through brief recipes that teach specific features of the software and scripting systems.
Second, you’ll apply a collection of snippets to address common gameplay scenarios, such as properly keeping score.
Using our cookbook format, we pinpoint the problem, set out the solution, and discuss how to solve your problem in the best and most straightforward way possible. This book is ideal for beginning to intermediate Unity developers.
You’ll find solutions for:
- 2D and 3D graphics
- Math, physics, and character control
- Animation and movement
- Behavior and AI
- Sound and music
- Input and gameplay
- Scripting and user interface
Publisher resources
Table of contents
- Preface
- 1. Working with Unity
-
2. Scripting
- 2.1. Working with MonoBehaviours
- 2.2. Using Callbacks
- 2.3. Creating Frame Rate–Independent Behavior
- 2.4. Accessing Components
- 2.5. Finding Objects
- 2.6. Using Coroutines
- 2.7. Singletons
- 2.8. Loading a Level (Scene)
- 2.9. Storing Data on Disk
- 2.10. Saving and Loading the Game State
- 2.11. Managing Objects Using an Object Pool
- 2.12. Storing Data in Assets Using ScriptableObject
- 3. Input
- 4. Math
-
5. 2D Graphics
- 5.1. Importing 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
- 6.7. Using High-Dynamic-Range Colors
- 6.8. Setting Up a Project to Use a Scriptable Render Pipeline
- 6.9. Creating a Shader Using the Shader Graph
- 6.10. Creating a Glowing Effect Using the Shader Graph
- 6.11. Exposing Properties from a Shader Graph
- 6.12. Animating a Shader over Time
- 6.13. Controlling the Speed of an Animated Shader
- 6.14. Using a Subgraph to Reuse Graph Components
- 6.15. Implementing a Dissolve Effect Using a Shader Graph
- 6.16. Using Baked Lighting and Real-Time Lighting
- 6.17. Using Baked Emission Sources
- 6.18. Making Static Objects Cast Shadows on Dynamic Objects
- 6.19. Using Light Probes to Influence Lighting
- 6.20. Using Reflection Probes
- 6.21. Faking a Dynamic Emissive Object
- 6.22. Loading Textures from Disk
- 6.23. Rendering to a Texture
- 6.24. Saving Screenshots
-
7. Physics and Character Control
- 7.1. Understanding FixedUpdate
- 7.2. Implementing Mouselook
- 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. Gameplay
- 9.1. Managing Quests
- 9.2. Managing Hitpoints
- 9.3. Creating a Top-Down Camera
- 9.4. Dragging a Box to Select Objects
- 9.5. Creating a Menu Structure
- 9.6. Creating a Wheeled Vehicle
- 9.7. Keeping a Car from Tipping Over
- 9.8. Creating Speed Boosts
- 9.9. Creating a Camera That Orbits Around Its Target
- 9.10. Creating Orbiting Cameras That Won’t Clip Through Walls
- 9.11. Detecting When the Player Has Completed a Lap
-
10. Behavior and AI
- 10.1. Defining a Path That AI Entities and the Player Can Follow
- 10.2. Letting Entities in Your Game Follow a Path
- 10.3. Enemies Detecting When They Can See the Player
- 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
- 11. Sound and Music
-
12. User Interface
- 12.1. Working with UI Controls
- 12.2. Theming Controls
- 12.3. Animating the UI
- 12.4. Creating a List of Items
- 12.5. Fading Out List Items
- 12.6. Creating Onscreen Position Indicators
- 12.7. Custom Editors
- 12.8. Property Drawers
- 12.9. Attribute Drawers
- 12.10. Asset Processing
- 12.11. Scripted Importers
- 12.12. Wizards
- Index
Product information
- Title: Unity Game Development Cookbook
- Author(s):
- Release date: March 2019
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781491999158
You might also like
book
2D Game Development with Unity
This book teaches beginners and aspiring game developers how to develop 2D games with Unity. Thousands …
book
Unity Development Cookbook, 2nd Edition
Learn everything you need to know to use the powerful Unity engine to its full potential …
video
Unity C# Scripting — Complete C# for Unity Game Development
Unity is free, easy to learn, has excellent documentation, and is the game engine used to …
book
Unity for Absolute Beginners
Unity for Absolute Beginners walks you through the fundamentals of creating a small third-person shooter game …