O'Reilly logo

Unity 5.x Cookbook by Chico Queiroz, Matt Smith

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Pausing the game

As compelling as your next game will be, you should always let players pause it for a short break. In this recipe, we will implement a simple and effective pause screen including controls for changing the display's quality settings.

Getting ready

For this recipe, we have prepared a package named BallGame containing a playable scene. The package is in the 1362_11_01 folder.

How to do it...

To pause your game upon pressing the Esc key, follow these steps:

  1. Import the BallGame package into your project and, from the Project view, open the level named BallGame_01.
  2. In the Inspector, create a new tag Ball, apply this tag to prefab ball in Prefabs folder, and save the scene.
  3. From the Hierarchy view, use the Create drop-down menu to add a Panel ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required