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:
- Import the
BallGame
package into your project and, from the Project view, open the level namedBallGame_01
. - In the Inspector, create a new tag Ball, apply this tag to prefab
ball
inPrefabs
folder, and save the scene. - From the Hierarchy view, use the Create drop-down menu to add a Panel to the UI (Create | UI | Panel). Note that it will automatically add it to the current Canvas in the scene. Rename the panel
QualityPanel
. - Now use the Create drop-down menu to add a Slider to the UI (Create | UI | Slider). Rename it
QualitySlider...