Game Development Reference
In-Depth Information
We can just set the
Fixed Width
and
Fixed Height
properies in
GUIStyle
to match our image
size. For instance, we have our exit buton image, which is 26 pixels wide and 22 pixels high.
We just set the
Fixed Width
to 26 and
Fixed Height
to 22. We can also set only
Fixed Width
or
Fixed Height
in
GUIStyle
—as we already did in our
Custom Styles
Tab Button
—as we
can see in the following figure:
We set the
Fixed Height
to
31
, and we leave the
Fixed Width
at
0
, which means that the
height of the style will always be 31 pixels but the width can vary from zero to infinity.
Creating a menu object
Coninuing from the irst step, we will now create our menu game object in the scene, with
which we will be able to open and close the menu window. Pressing the
M
key will open the
menu window, and clicking on the
close
buton in the window will close the menu window.
We will also create three tab butons for the player to be able to see through the diferent
pages,
STATUS
,
INVENTORY
, and
EQUIPMENT
, as we can see in the following screenshot: