Game Development Reference
In-Depth Information
return SetTo;
}
Now in our OnGUI function, we'll need to adjust some of our code. Before we start
our controls group, we will check whether our controls pop up is activated. Add the
if statement to our code and encapsulate the Controls Group:
if(!ShowPopup)
{
Next, we'll edit some of our GUI buttons to allow customization. Start with the
PC_Item1 button and change it to this code:
if(GUI.Button(new Rect(150, 125, 135, 20),
PC_Item1))
{
ShowPopup = true;
PreviousKey = pcItem1;
}
Do the same thing for the following buttons:
PC_Item2
PC_Item3
PC_Item4
PC_Pause
PC_Inv
Xbox_Inv
Xbox_Pause
Set ShowPopup to true and PreviousKey to its expected value, accordingly,
such as pcItem2 , pcItem3 , pcItem4 , and so on. Place a closing bracket after-
wards to close the if statement that we created earlier.
Search WWH ::




Custom Search