
Unity Development Cookbook
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
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
More details
Other editions
Additional editions

Content
- Cover
- Copyright
- Table of Contents
- Preface
- Audience and Approach
- Organization of This Book
- Conventions Used in This Book
- O'Reilly Online Learning
- How to Contact Us
- Acknowledgments
- Chapter 1. Working in Unity
- 1.1 Getting Around in Unity
- Problem
- Solution
- Discussion
- 1.2 Working with Game Objects
- Problem
- Solution
- Discussion
- 1.3 Working with Components
- Problem
- Solution
- Discussion
- 1.4 Working with Prefabs
- Problem
- Solution
- Discussion
- 1.5 Working with Scenes
- Problem
- Solution
- Discussion
- 1.6 Managing Assets
- Problem
- Solution
- Discussion
- 1.7 Building Unity Projects
- Problem
- Solution
- Discussion
- 1.8 Accessing Preferences
- Problem
- Solution
- Discussion
- 1.9 Installing Unity Packages
- Problem
- Solution
- Discussion
- Chapter 2. Scripting
- 2.1 Adding a Script to an Object in a Unity Scene
- Problem
- Solution
- Discussion
- 2.2 Running Code at Specific Times in a Script's (or Game Object's) Life
- Problem
- Solution
- Discussion
- 2.3 Creating Frame Rate-Independent Behavior
- Problem
- Solution
- Discussion
- 2.4 Using the Components of a Game Object
- Problem
- Solution
- Discussion
- 2.5 Finding Objects Attached to a Game Object
- Problem
- Solution
- Discussion
- 2.6 Singletons
- Problem
- Solution
- Discussion
- 2.7 Using Coroutines to Manage When Code Runs
- Problem
- Solution
- Discussion
- 2.8 Managing Objects Using an Object Pool
- Problem
- Solution
- Discussion
- 2.9 Storing Data in Assets Using ScriptableObject
- Problem
- Solution
- Discussion
- Chapter 3. Input
- 3.1 Getting Simple Keyboard Input
- Problem
- Solution
- Discussion
- 3.2 Using the Unity Input System
- Problem
- Solution
- Discussion
- 3.3 Using Input Actions
- Problem
- Solution
- Discussion
- 3.4 Locking and Hiding the Mouse Cursor
- Problem
- Solution
- Discussion
- 3.5 Responding to Mouseover and Click Events
- Problem
- Solution
- Discussion
- Chapter 4. Mathematics
- 4.1 Storing Coordinates of Varying Dimensions Using Vectors
- Problem
- Solution
- Discussion
- 4.2 Rotating in 3D Space
- Problem
- Solution
- Discussion
- 4.3 Performing Transformations in 3D Space with Matrices
- Problem
- Solution
- Discussion
- 4.4 Working with Angles
- Problem
- Solution
- Discussion
- 4.5 Finding the Distance to a Target
- Problem
- Solution
- Discussion
- 4.6 Finding the Angle to a Target
- Problem
- Solution
- Discussion
- Chapter 5. 2D Graphics
- 5.1 Importing Images as Sprites
- Problem
- Solution
- Discussion
- 5.2 Adding a Sprite to the Scene
- Problem
- Solution
- Discussion
- 5.3 Creating a Sprite Animation
- Problem
- Solution
- Discussion
- 5.4 Creating a Sprite with 2D Physics
- Problem
- Solution
- Discussion
- 5.5 Customizing Sprite Collision Shapes
- Problem
- Solution
- Discussion
- 5.6 Using a Composite Collider
- Problem
- Solution
- Discussion
- 5.7 Using the Sprite Packer
- Problem
- Solution
- Discussion
- 5.8 Applying Forces to 2D Objects
- Problem
- Solution
- Discussion
- 5.9 Creating a Conveyor Belt
- Problem
- Solution
- Discussion
- 5.10 Using a Custom Material for Sprites
- Problem
- Solution
- Discussion
- 5.11 Managing Sprite Sorting
- Problem
- Solution
- Discussion
- 5.12 Using Sorting Groups
- Problem
- Solution
- Discussion
- 5.13 Creating a 2.5D Scene
- Problem
- Solution
- Discussion
- Chapter 6. 3D Graphics
- 6.1 Creating a Simple Material
- Problem
- Solution
- Discussion
- 6.2 Controlling a Material's Property Through a Script
- Problem
- Solution
- Discussion
- 6.3 Creating an Unlit Material
- Problem
- Solution
- Discussion
- 6.4 Setting Up a Material Using Textures
- Problem
- Solution
- Discussion
- 6.5 Making a Material Use a Shader
- Problem
- Solution
- Discussion
- 6.6 Setting Up a Bloom Effect Using Post-Processing with the Built-In Render Pipeline
- Problem
- Solution
- Discussion
- 6.7 Setting Up a Bloom Effect Using Post-Processing with the Universal Render Pipeline
- Problem
- Solution
- Discussion
- 6.8 Using High-Dynamic-Range Colors
- Problem
- Solution
- Discussion
- 6.9 Setting Up a Project to Use a Scriptable Render Pipeline
- Problem
- Solution
- Discussion
- 6.10 Creating a Shader Using the Shader Graph
- Problem
- Solution
- Discussion
- 6.11 Creating a Glowing Effect Using the Shader Graph
- Problem
- Solution
- Discussion
- 6.12 Exposing Properties from a Shader Graph
- Problem
- Solution
- Discussion
- 6.13 Animating a Shader over Time
- Problem
- Solution
- Discussion
- 6.14 Controlling the Speed of an Animated Shader
- Problem
- Solution
- Discussion
- 6.15 Using a Subgraph to Reuse Graph Components
- Problem
- Solution
- Discussion
- 6.16 Implementing a Dissolve Effect Using a Shader Graph
- Problem
- Solution
- Discussion
- 6.17 Using Baked Lighting and Real-Time Lighting
- Problem
- Solution
- Discussion
- 6.18 Using Baked Emission Sources
- Problem
- Solution
- Discussion
- 6.19 Making Static Objects Cast Shadows on Dynamic Objects
- Problem
- Solution
- Discussion
- 6.20 Using Light Probes to Influence Lighting
- Problem
- Solution
- Discussion
- 6.21 Using Reflection Probes
- Problem
- Solution
- Discussion
- 6.22 Faking a Dynamic Emissive Object
- Problem
- Solution
- Discussion
- 6.23 Rendering to a Texture
- Problem
- Solution
- Discussion
- Chapter 7. 3D Physics and Character Control
- 7.1 Running Code a Specific Number of Times per Second
- Problem
- Solution
- Discussion
- 7.2 Allowing the Player to Look Around Using the Mouse
- Problem
- Solution
- Discussion
- 7.3 Controlling a 3D Character
- Problem
- Solution
- Discussion
- 7.4 Interacting with Switches and Objects
- Problem
- Solution
- Discussion
- 7.5 Picking Up and Putting Down Objects
- Problem
- Solution
- Discussion
- 7.6 Detecting When an Object Is Touching Another Object
- Problem
- Solution
- Discussion
- 7.7 Detecting When an Object Is in a Trigger Area
- Problem
- Solution
- Discussion
- 7.8 Implementing Moving Platforms
- Problem
- Solution
- Discussion
- 7.9 Implementing Platform Riding
- Problem
- Solution
- Discussion
- 7.10 Responding to Being Pushed by Objects
- Problem
- Solution
- Discussion
- Chapter 8. Animation and Movement
- 8.1 Animating an Object
- Problem
- Solution
- Discussion
- 8.2 Basic Character Movement
- Problem
- Solution
- Discussion
- 8.3 Inverse Kinematics
- Problem
- Solution
- Discussion
- 8.4 Masked Movement
- Problem
- Solution
- Discussion
- 8.5 Blended Movement
- Problem
- Solution
- Discussion
- 8.6 Navigation and Animating in Sync
- Problem
- Solution
- Discussion
- 8.7 Cinematic Camera Tracking
- Problem
- Solution
- Discussion
- 8.8 Automatically Switching Cameras
- Problem
- Solution
- Discussion
- 8.9 Keeping Multiple Objects in View
- Problem
- Solution
- Discussion
- 8.10 Dollying a Camera
- Problem
- Solution
- Discussion
- Chapter 9. Logic and Gameplay
- 9.1 Loading a New Scene File
- Problem
- Solution
- Discussion
- 9.2 Managing Hit Points
- Problem
- Solution
- Discussion
- 9.3 Creating a Top-Down Camera
- Problem
- Solution
- Discussion
- 9.4 Managing Quests
- Problem
- Solution
- Discussion
- 9.5 Dragging a Box to Select Objects
- Problem
- Solution
- Discussion
- 9.6 Creating a Menu Structure
- Problem
- Solution
- Discussion
- 9.7 Creating a Wheeled Vehicle
- Problem
- Solution
- Discussion
- 9.8 Keeping a Car from Tipping Over
- Problem
- Solution
- Discussion
- 9.9 Creating Speed Boosts
- Problem
- Solution
- Discussion
- 9.10 Creating a Camera That Orbits Around Its Target
- Problem
- Solution
- Discussion
- 9.11 Creating an Orbiting Camera That Won't Clip Through Walls
- Problem
- Solution
- Discussion
- 9.12 Detecting When the Player Has Completed a Lap
- Problem
- Solution
- Discussion
- Chapter 10. Behavior, Simulation, and AI
- 10.1 Enemies Detecting When They Can See the Player
- Problem
- Solution
- Discussion
- 10.2 Defining a Path That AI Entities and the Player Can Follow
- Problem
- Solution
- Discussion
- 10.3 Letting Entities in Your Game Follow a Path
- Problem
- Solution
- Discussion
- 10.4 Finding a Good Distribution of Random Points (Poisson Disc)
- Problem
- Solution
- Discussion
- 10.5 Enemies Detecting Where They Can Take Cover
- Problem
- Solution
- Discussion
- 10.6 Building and Using a State Machine
- Problem
- Solution
- Discussion
- 10.7 Building a Simulation Environment for Machine Learning
- Problem
- Solution
- Chapter 11. Sound and Music
- 11.1 Playing Sounds
- Problem
- Solution
- Discussion
- 11.2 Setting Up a Mixer
- Problem
- Solution
- Discussion
- 11.3 Using Audio Effects
- Problem
- Solution
- Discussion
- 11.4 Using Send and Receive Effects
- Problem
- Solution
- Discussion
- 11.5 Ducking
- Problem
- Solution
- Discussion
- 11.6 Using Multiple Audio Zones
- Problem
- Solution
- Discussion
- 11.7 Playing Audio with Scripts
- Problem
- Solution
- Discussion
- 11.8 Using a Sound Manager
- Problem
- Solution
- Discussion
- Chapter 12. User Interface
- 12.1 Working with UI Controls
- Problem
- Solution
- Discussion
- 12.2 Theming Controls
- Problem
- Solution
- Discussion
- 12.3 Animating the UI
- Problem
- Solution
- Discussion
- 12.4 Creating a List of Items
- Problem
- Solution
- Discussion
- 12.5 Fading Out List Items
- Problem
- Solution
- Discussion
- 12.6 Creating Onscreen Position Indicators
- Problem
- Solution
- Discussion
- 12.7 Custom Editors
- Problem
- Solution
- Discussion
- 12.8 Property Drawers
- Problem
- Solution
- Discussion
- 12.9 Attribute Drawers
- Problem
- Solution
- Discussion
- 12.10 Asset Processing
- Problem
- Solution
- Discussion
- 12.11 Wizards
- Problem
- Solution
- Discussion
- Chapter 13. Files, Networking, and Screenshots
- 13.1 Saving Files
- Problem
- Solution
- Discussion
- 13.2 Saving an Image File of Your Game to Disk
- Problem
- Solution
- Discussion
- 13.3 Loading Textures from Disk
- Problem
- Solution
- Discussion
- 13.4 Saving and Loading a Game's State
- Problem
- Solution
- Discussion
- 13.5 Downloading and Parsing JSON from the Web
- Problem
- Solution
- Discussion
- 13.6 Scripted Importers
- Problem
- Solution
- Discussion
- Index
- About the Authors
System requirements
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.