Unity in Action, Third Edition: Multiplatform game development in C#
This hands-on beginners guide gets you building games fast, all with the awesome Unity engine! You’ll speed past the basics and use your existing coding skills to create 2D, 3D, and AR/VR games.

In Unity in Action, Third Edition, you will learn how to:

    Create characters that run, jump, and bump into things
    Build 3D first-person shooters and third-person action games
    Construct 2D card games and side-scrolling platformers
    Script enemies with AI
    Improve game graphics by importing models and images
    Design an intuitive user interface for your games
    Play music and spatially-aware sound effects
    Connect your games to the internet for online play
    Deploy your games to desktop, mobile, and the web

Thousands of new game developers have chosen Joe Hocking’s Unity in Action as their first step toward Unity mastery. Starting with the initial groundwork of a new game development project, you’ll quickly start writing custom code instead of clicking together premade scripts. This fully updated third edition comes packed with fully refreshed graphics, Unity’s latest features, and coverage of augmented and virtual reality toolkits. You'll master the Unity toolset from the ground up, learning the skills to go from application coder to game developer.

Foreword by Jesse Schell.

About the technology
Writing games is rewarding and fun—and with Unity, it’s easy to get started! Unity handles the heavy lifting, so you can focus on game play, graphics, and user experience. C# support and a huge ecosystem of prebuilt components help even first-time developers go from the drawing board to the screen fast.

About the book
Unity in Action, Third Edition teaches you to create games with the Unity game platform. It’s many 2D, 3D, and AR/VR game examples give you hands-on experience with Unity’s workflow tools and state-of-the-art rendering engine. This fully updated third edition presents new coverage of Unity’s XR toolkit and shows you how you can start building with virtual and augmented reality.

What's inside

    Create characters that run, jump, and bump into things
    Script enemies with AI
    Play music and spatially-aware sound effects
    Deploy your games to desktop, mobile, and the web

About the reader
For programmers who know any object-oriented programming language. Examples are in C#.

About the author
Joe Hocking is a software engineer and Unity expert specializing in interactive media development.

Table of Contents
PART 1 FIRST STEPS
1 Getting to know Unity
2 Building a demo that puts you in 3D space
3 Adding enemies and projectiles to the 3D game
4 Developing graphics for your game
PART 2 GETTING COMFORTABLE
5 Building a Memory game using Unity’s 2D functionality
6 Creating a basic 2D platformer
7 Putting a GUI onto a game
8 Creating a third-person 3D game: Player movement and animation
9 Adding interactive devices and items within the game
PART 3 STRONG FINISH
10 Connecting your game to the internet
11 Playing audio: Sound effects and music
12 Putting the parts together into a complete game
13 Deploying your game to players’ devices
1140841140
Unity in Action, Third Edition: Multiplatform game development in C#
This hands-on beginners guide gets you building games fast, all with the awesome Unity engine! You’ll speed past the basics and use your existing coding skills to create 2D, 3D, and AR/VR games.

In Unity in Action, Third Edition, you will learn how to:

    Create characters that run, jump, and bump into things
    Build 3D first-person shooters and third-person action games
    Construct 2D card games and side-scrolling platformers
    Script enemies with AI
    Improve game graphics by importing models and images
    Design an intuitive user interface for your games
    Play music and spatially-aware sound effects
    Connect your games to the internet for online play
    Deploy your games to desktop, mobile, and the web

Thousands of new game developers have chosen Joe Hocking’s Unity in Action as their first step toward Unity mastery. Starting with the initial groundwork of a new game development project, you’ll quickly start writing custom code instead of clicking together premade scripts. This fully updated third edition comes packed with fully refreshed graphics, Unity’s latest features, and coverage of augmented and virtual reality toolkits. You'll master the Unity toolset from the ground up, learning the skills to go from application coder to game developer.

Foreword by Jesse Schell.

About the technology
Writing games is rewarding and fun—and with Unity, it’s easy to get started! Unity handles the heavy lifting, so you can focus on game play, graphics, and user experience. C# support and a huge ecosystem of prebuilt components help even first-time developers go from the drawing board to the screen fast.

About the book
Unity in Action, Third Edition teaches you to create games with the Unity game platform. It’s many 2D, 3D, and AR/VR game examples give you hands-on experience with Unity’s workflow tools and state-of-the-art rendering engine. This fully updated third edition presents new coverage of Unity’s XR toolkit and shows you how you can start building with virtual and augmented reality.

What's inside

    Create characters that run, jump, and bump into things
    Script enemies with AI
    Play music and spatially-aware sound effects
    Deploy your games to desktop, mobile, and the web

About the reader
For programmers who know any object-oriented programming language. Examples are in C#.

About the author
Joe Hocking is a software engineer and Unity expert specializing in interactive media development.

Table of Contents
PART 1 FIRST STEPS
1 Getting to know Unity
2 Building a demo that puts you in 3D space
3 Adding enemies and projectiles to the 3D game
4 Developing graphics for your game
PART 2 GETTING COMFORTABLE
5 Building a Memory game using Unity’s 2D functionality
6 Creating a basic 2D platformer
7 Putting a GUI onto a game
8 Creating a third-person 3D game: Player movement and animation
9 Adding interactive devices and items within the game
PART 3 STRONG FINISH
10 Connecting your game to the internet
11 Playing audio: Sound effects and music
12 Putting the parts together into a complete game
13 Deploying your game to players’ devices
36.99 In Stock
Unity in Action, Third Edition: Multiplatform game development in C#

Unity in Action, Third Edition: Multiplatform game development in C#

by Joe Hocking
Unity in Action, Third Edition: Multiplatform game development in C#

Unity in Action, Third Edition: Multiplatform game development in C#

by Joe Hocking

eBook

$36.99 

Available on Compatible NOOK devices, the free NOOK App and in My Digital Library.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

This hands-on beginners guide gets you building games fast, all with the awesome Unity engine! You’ll speed past the basics and use your existing coding skills to create 2D, 3D, and AR/VR games.

In Unity in Action, Third Edition, you will learn how to:

    Create characters that run, jump, and bump into things
    Build 3D first-person shooters and third-person action games
    Construct 2D card games and side-scrolling platformers
    Script enemies with AI
    Improve game graphics by importing models and images
    Design an intuitive user interface for your games
    Play music and spatially-aware sound effects
    Connect your games to the internet for online play
    Deploy your games to desktop, mobile, and the web

Thousands of new game developers have chosen Joe Hocking’s Unity in Action as their first step toward Unity mastery. Starting with the initial groundwork of a new game development project, you’ll quickly start writing custom code instead of clicking together premade scripts. This fully updated third edition comes packed with fully refreshed graphics, Unity’s latest features, and coverage of augmented and virtual reality toolkits. You'll master the Unity toolset from the ground up, learning the skills to go from application coder to game developer.

Foreword by Jesse Schell.

About the technology
Writing games is rewarding and fun—and with Unity, it’s easy to get started! Unity handles the heavy lifting, so you can focus on game play, graphics, and user experience. C# support and a huge ecosystem of prebuilt components help even first-time developers go from the drawing board to the screen fast.

About the book
Unity in Action, Third Edition teaches you to create games with the Unity game platform. It’s many 2D, 3D, and AR/VR game examples give you hands-on experience with Unity’s workflow tools and state-of-the-art rendering engine. This fully updated third edition presents new coverage of Unity’s XR toolkit and shows you how you can start building with virtual and augmented reality.

What's inside

    Create characters that run, jump, and bump into things
    Script enemies with AI
    Play music and spatially-aware sound effects
    Deploy your games to desktop, mobile, and the web

About the reader
For programmers who know any object-oriented programming language. Examples are in C#.

About the author
Joe Hocking is a software engineer and Unity expert specializing in interactive media development.

Table of Contents
PART 1 FIRST STEPS
1 Getting to know Unity
2 Building a demo that puts you in 3D space
3 Adding enemies and projectiles to the 3D game
4 Developing graphics for your game
PART 2 GETTING COMFORTABLE
5 Building a Memory game using Unity’s 2D functionality
6 Creating a basic 2D platformer
7 Putting a GUI onto a game
8 Creating a third-person 3D game: Player movement and animation
9 Adding interactive devices and items within the game
PART 3 STRONG FINISH
10 Connecting your game to the internet
11 Playing audio: Sound effects and music
12 Putting the parts together into a complete game
13 Deploying your game to players’ devices

Product Details

ISBN-13: 9781638350576
Publisher: Manning
Publication date: 03/01/2022
Sold by: SIMON & SCHUSTER
Format: eBook
Pages: 416
File size: 23 MB
Note: This product may take a few minutes to download.

About the Author

Joe Hocking is a software engineer who specializes in interactive media development. He currently works for Qualcomm, wrote most of the third edition while working for BUNDLAR, and wrote the first edition while at Synapse Games. He has also taught classes at the University of Illinois Chicago, the School of the Art Institute of Chicago, and Columbia College Chicago. He lives in the Chicago suburbs with his wife and two kids. His website is www.newarteest.com.

Table of Contents

Foreword xv

Preface xvii

Acknowledgments xix

About this book xxi

About the author xxv

About the cover illustration xxvi

Part 1 First steps 1

1 Getting to know Unity 3

1.1 Why is Unity so great? 4

Unity's strengths and advantages 4

Downsides to be aware of 6

Example games built with Unity 7

1.2 How to use Unity 10

Scene view, Game view, and the Toolbar 12

The mouse and keyboard 14

The Hierarchy view and the Inspector panel 15

The Project and Console tabs 16

1.3 Getting up and running with Unity programming 16

Running code in Unity: Script components 17

Using Visual Studio, the included IDE 18

Printing to the console: Hello World! 19

2 Building a demo that puts you in 3D space 23

2.1 Before you start… 24

Planning the project 24

Understanding 3D coordinate space 25

2.2 Begin the project: Place objects in the scene 27

The scenery: Floor, outer walls, and inner walls 28

Lights and cameras 30

The player's collider and viewpoint 32

2.3 Make things move: A script that applies transforms 33

Visualizing how movement is programmed 33

Writing code to implement the diagram 34

Understanding local vs. global coordinate space 35

2.4 Script component for looking around: MouseLook 37

Horizontal rotation that tracks mouse movement 38

Vertical rotation with limits 39

Horizontal and vertical rotation at the same time 41

2.5 Keyboard input component: First-person controls 44

Responding to keypresses 44

Setting a rate of movement independent of the computer's speed 45

Moving the CharacterController for collision detection 46

Adjusting components for walking instead of flying 47

3 Adding enemies and projectiles to the 3D game 50

3.1 Shooting via raycasts 51

What is raycasting? 51

Using the ScreenPointToRay command for shooting 52

Adding visual indicators for aiming and hits 54

3.2 Scripting reactive targets 57

Determining what was hit 57

Alerting the target that it was hit 58

3.3 Basic wandering AI 60

Diagramming how basic AI works 60

"Seeing" obstacles with a raycast 61

Tracking the character's state 62

3.4 Spawning enemy prefabs 64

What is a prefab? 64

Creating the enemy prefab 65

Instantiating from, an invisible SceneController 65

3.5 Shooting by instantiating objects 68

Creating the projectile prefab 68

Shooting the projectile and colliding with a target 70

Damaging the player 73

4 Developing graphics for your game 75

4.1 Understanding art assets 76

4.2 Building basic 3D scenery: Whiteboxing 78

Whiteboxing explained 79

Drawing a floor plan for the level 79

Laying out primitives according to the plan 80

4.3 Texturing the scene with 2D images 82

Choosing a file format 83

Importing an image file 84

Applying the image 85

4.4 Generating sky visuals by using texture images 87

What is a skybox? 87

Creating a new skybox material 88

4.5 Working with custom 3D models 90

Which file format to choose? 91

Exporting and importing the model 92

4.6 Creating effects by using particle systems 95

Adjusting parameters on the default effect 96

Applying a new texture for fire 98

Attaching particle effects to 3D objects 99

Part 2 Getting comfortable 101

5 Building a Memory game using Unity's 2D functionality 103

5.1 Setting up everything for 2D graphics 104

Preparing the project 105

Displaying 2D images (aka sprites) 107

Switching the camera to 2D mode 108

5.2 Building a card object and making it react to clicks 110

Building the object out of sprites 110

Mouse input code 111

Revealing the card on a click 112

5.3 Displaying the various card images 113

Loading images programmatically 113

Setting the image from an invisible SceneController 114

Instantiating a grid of cards 116

Shuffling the cards 118

5.4 Making and scoring matches 119

Storing and comparing revealed cards 120

Hiding mismatched cards 120

Text display for the score 121

5.5 Restart button 123

Programming a UIButton component by using SendMessage 124

Calling LoadScene from SceneController 126

6 Creating a basic 2D platformer 128

6.1 Setting up the graphics 129

Placing the scenery 129

Importing sprite sheets 130

6.2 Moving the player left and right 132

Writing keyboard controls 133

Colliding with the block 134

6.3 Playing the sprite's animation 134

Explaining the Mecanim animation system 134

Triggering animations from code 136

6.4 Adding the ability to jump 137

Falling from gravity 137

Applying an upward impulse 138

Detecting the ground 139

6.5 Additional features for a platform game 140

Unusual floors: Slopes and one-way platforms 140

Implementing moving platforms 142

Camera control 145

7 Putting a GUI onto a game 147

7.1 Before you start writing code… 149

Immediate mode GUI or advanced 2D interface? 149

Planning the layout 150

Importing UI images 151

7.2 Setting up the GUI display 151

Creating a canvas for the interface 151

Buttons, images, and text labels 153

Controlling the position of UI elements 156

7.3 Programming interactivity in the UI 157

Programming an invisible UIController 158

Creating a pop-up window 160

Setting values using sliders and input fields 163

7.4 Updating the game by responding to events 166

Integrating an event system 166

Broadcasting and listening for events from the scene 167

Broadcasting and listening for events from the HUD 168

8 Creating a third-person 3D game: Player movement and animation 171

8.1 Adjusting the camera view for third-person 173

Importing a character to look at 174

Adding shadows to the scene 175

Orbiting the camera around the player character 177

8.2 Programming camera-relative movement controls 180

Rotating the character-to face movement direction 180

Moving forward in that direction 183

8.3 Implementing the jump action 184

Applying vertical speed and acceleration 185

Modifying the ground detection to handle edges and slopes 186

8.4 Setting up animations on the player character 190

Defining animation clips in the imported model 192

Creating the animator controller for these animations 194

Writing code that operates the animator 197

9 Adding interactive devices and items within the game 200

9.1 Creating doors and other devices 201

Doors that open and close on a keypress 201

Checking distance and facing before opening the door 203

Operating a color-changing monitor 205

9.2 Interacting with objects by bumping into them 206

Colliding with physics-enabled obstacles 206

Operating the door with a trigger object 207

Collecting items scattered around the level 210

9.3 Managing inventory data and game state 212

Setting up player and inventory managers 212

Programming the game managers 214

Storing inventory in a collection object: List vs. Dictionary 217

9.4 Inventory UI for using and equipping items 220

Displaying inventory items in the IT 220

Equipping a key to use on locked doors 223

Restoring the player's health by consuming health packs 224

Part 3 Strong finish 227

10 Connecting your game to the internet 229

10.1 Creating an outdoor scene 231

Generating sky visuals by using a skybox 231

Setting up an atmosphere that's controlled by code 232

10.2 Downloading weather data from an internet service 235

Requesting HTTP data using coroutines 238

Parsing XML 242

Parsing JSON 243

Affecting the scene based on weather data 246

10.3 Adding a networked billboard 247

Loading images from the internet 247

Displaying images on the billboard 250

Caching the downloaded image for reuse 251

10.4 Posting data to a web server 253

Tracking current weather: Sending post requests 254

Server-side code in PHP 255

11 Playing audio: Sound effects and music 257

11.1 Importing sound effects 258

Supported file formats 258

Importing audio files 260

11.2 Playing sound effects 261

Explaining what's involved: Audio clip vs. source vs. listener 261

Assigning a looping sound 263

Triggering sound effects from code 264

11.3 Using the audio control interface 265

Setting up the central AudioManager 265

Volume control UI 267

Playing UI sounds 271

11.4 Adding background music 272

Playing music loops 272

Controlling music volume separately 276

Fading between songs 278

12 Putting the parts together into a complete game 282

12.1 Building an action RPG by repurposing projects 283

Assembling assets and code from multiple projects 284

Programming point-and-click controls: Movement and devices 286

Replacing the old GUI with a new interface 292

12.2 Developing the overarching game structure 299

Controlling mission flow and multiple levels 299

Computing a level by reaching the exit 303

Losing the level when caught by enemies 305

12.3 Handling the player's progression through the game 307

Saving and loading the player's progress 307

Beating the game by completing three levels 311

13 Deploying your game to players' devices 314

13.1 Start by building for the desktop: Windows, Mac, and Linux 317

Building the application 317

Adjusting player settings: Setting the game's name and icon 318

Platform-dependent compilation 319

13.2 Building for the web 321

Building the game embedded in a web page 321

Communicating with JavaScript in the browser 322

13.3 Building for mobile: iOS and Android 325

Setting up the build tools 326

Texture compression 331

Developing plugins 332

13.4 Developing XR (both VR and AR) 341

Supporting virtual reality headsets 341

AR Foundation for mobile Augmented Reality 342

Afterword 349

Appendix A Scene navigation and keyboard shortcuts 353

Appendix B External tools used alongside Unity 356

Appendix C Modeling a bench in Blender 360

Appendix D Online learning resources 369

Index 373

From the B&N Reads Blog

Customer Reviews