Game Development Reference
In-Depth Information
As we want everything inside our menu window, we used the
DoMyWindow()
function to take
GUI.Window
as one parameter. Inside the
DoMyWindow()
function, we create all the buttons and textures. Then, we make our window drag-
gable by adding
GUI.DragWindow()
. With that, we are done with coding for
this step.
8. Next, go back to Unity, click on the
Menu
script file and drag-and-drop it to
MenuObject
in the
Hierarchy
view. Next, click on
MenuObject
in the
Hier-
archy
view, open the
Inspector
view under the
menu
(script), and set the para-
meters as follows:
Parameters
Settings
Custom Skin
Drag-and-drop
MenuSkin
Hero Texture
Drag-and-drop
player
Stat Box 1Texture
Drag-and-drop
stat1
Stat Box 2Texture
Drag-and-drop
stat2
Skill Box Texture:
Drag-and-drop
skillBox
9. Then, we can click on the
Play
button to see the result. In the game scene, we can
press the
M
key to bring up our window and click on the
x
button at the top-right
corner of the screen to close it, as shown in the following screenshot: