Graphics Reference
In-Depth Information
Start single player
Start co-op
Main menu
Start single player
Start co-op
Options
Exit
Main game
Exit
Application.quit()
Options
Options
Audio
Graphics
Back to main menu
Back
Graphics
Audio
Audio options
SFX volume slider
Music volume slider
Back to options menu
Graphics options
Detail level slider
Back to options menu
Back
Back
Figure 10.1 The menu flow.
these saved values exist and, in cases where the data have not yet been saved, create new
PlayerPrefs saved data as required.
We can use the same exit button and exit confirmation (a simple “Are you sure you
want to quit?” yes/no menu), and the options will be exactly the same. It may be beneficial
to add the option to display an image instead of just text for the name of the game and it
would be easy to implement, so we should take care of that, too.
The menus will be built with Unity GUI, for the sake of simplicity, although the basic
reusable menu principles could easily be applied to a GUI using a custom or third-party
solution such as NGUI. Menus should also have the option to play some music in the back-
ground as well as play a sound effect whenever buttons are clicked, and the background
music should continue to play between menus without restarting or breaking.
The menu is a single class to keep it simple and to allow for easy expansion or porting
between projects. It is capable of displaying all different screens that make up the main
menu by using a variable to state which menu should be displayed, which is checked by a
case statement, and the correct screen composed within the OnGUI function.
To help make customization and stylization easier, the menu system uses a Unity
GUI skin named MenuGUIskin, which defines the font to use and any custom layout
requirements.
The options menu uses QualitySettings.names to find out how many different graph-
ics preferences are available and present them as a slider bar for easy modification by
players. Getting all of the available settings from QualitySettings.names (rather than
hard coding them) allows for a greater level of flexibility when porting between games,
as there may not always be the same number of graphics detail levels available (they are
Search WWH ::




Custom Search