Game Development Reference
In-Depth Information
Creating the settings menu
The final part of our optimizations will be to add a menu so that the player can
access and change the settings we created. Create a new C# script and name it Con-
fig_GUI .
Preparing the code
Now, we'll set up our code by adding variables, a start function, and an OnGUI func-
tion. Add this code to your script:
float volBG, volSFX, volATM, fov;
bool aa, shadows, sync, optionsGUI, full;
int res;
string settings, audiotype;
public Rect optionsRect = new Rect(100, 100,
500, 500);
void Start()
{
volBG = 0;
volATM = 0.3f;
volSFX = 0.8f;
fov = 90.00f;
aa = true;
fullscreen = true;
shadows = true;
optionsGUI = true;
LoadAll();
}
void OnGUI()
{
if(optionsGUI)
{
optionsRect = GUI.Window(0, optionsRect,
OptionsGUI, "Options");
Search WWH ::




Custom Search