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 ...

Get Unity 5.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.