What are the buttons, text, dropdowns, etc. that can be seen when playing a game? All of that is part of what is called the User Interface (UI). Most games have some sort of UI which makes it easier for players to switch between levels and activate certain controls (such as pausing the game or restarting a level). In a previous article describing how to create Dodger in Unity, we created a small button to refresh the game if a player lost.
In this tutorial, we are going to take that to the next level, and allow users to pause or restart the game and switch between different scenes. We will also be taking a look at how to show certain UI elements only at certain times - such as when the game is paused or when the player dies/loses.
Most games contain a pause menu, a game over screen, and a main menu. Since these are some of the few elements that are required for a “finished” game, we will insert all three into our Dodger clone. In addition, we will also create an instructions screen so that players will be able to learn the controls they can use before they start playing the game.
The completed game can be played at itch.io.
Creating a Basic Pause Screen
A pause screen has a common set of controls that players are able to use to restart a level, move back to the main menu, or un-pause the game. Pause screens should only be visible when the game is paused. In Unity we are, in general, able to differentiate between a paused and un-paused game by using Time.timescale. If the time scale is zero, the game is paused. If it’s greater than zero, the game is un-paused (we’ll discuss this later). Let’s get started!
Continue reading %Adding Pause, Main Menu and Game over Screens in Unity%
by Vincent Quarles via SitePoint
No comments:
Post a Comment