Game Development Reference
In-Depth Information
Adding the controls pop up to the GUI
It's time to add our controls pop up to the GUI. This is where the player will select
what control to swap. To do this, we will add an else statement, extending our if
statement, to create the pop up:
else
{
GUI.BeginGroup(new Rect(Screen.width/2 - 300,
Screen.height / 2 - 300, 600, 400));
GUI.Box(new Rect(0,0,600,400), "Pick A
Control to Switch");
if(GUI.Button(new Rect(150, 125, 135, 20),
"1"))
{
SetNewKey(PreviousKey, orig_pcItem1);
ShowPopup = false;
}
if(GUI.Button(new Rect(150, 150, 135, 20),
"2"))
{
SetNewKey(PreviousKey, orig_pcItem2);
ShowPopup = false;
}
if(GUI.Button(new Rect(150, 175, 135, 20),
"3"))
{
SetNewKey(PreviousKey, orig_pcItem3);
ShowPopup = false;
}
if(GUI.Button(new Rect(150, 200, 135, 20),
"4"))
{
SetNewKey(PreviousKey, orig_pcItem4);
ShowPopup = false;
}
if(GUI.Button(new Rect(150, 225, 135, 20),
Search WWH ::




Custom Search