Game Development Reference
In-Depth Information
GetComponent<Video_Config>().SetResolution(3,
3);
if(GUI.Button(new Rect(325, 95, 75, 20),
"640x400"))
GetComponent<Video_Config>().SetResolution(4,
3);
GUI.Label(new Rect(25, 125, 100, 30),
"FullScreen");
full = GUI.Toggle(new Rect(95, 125, 100, 30),
fullscreen, " On/Off");
For each option that we have, we make a block of code creating its label and buttons
for the player to see and adjust. The label is being used as a title for the option, so
the player knows what they are editing. The buttons are made available to change
the setting when they are clicked. Changing the fullscreen option is done with a
toggle button, which is a single button that can be turned on and off like a Boolean.
To adjust the field of view, we use a slider so that the player can scroll through many
options. Using the slider adds more customization as you don't need to create but-
tons. A slider isn't ideal for all options, but it fits perfectly to adjust the field of view.
Now let's continue to create the other options:
GUI.Label(new Rect(25, 140, 100, 30),
"Shadows");
shadows = GUI.Toggle(new Rect(95, 140, 100,
30), shadows, " On/Off");
GUI.Label(new Rect(25, 160, 150, 30), "Music
Volume");
volBG = GUI.HorizontalSlider(new Rect(25,
180, 100, 30), volBG, 0.00f, 1.00f);
GUI.Label(new Rect(25, 200, 150, 30), "SFX
Volume");
volSFX = GUI.HorizontalSlider(new Rect(25,
Search WWH ::




Custom Search