Game Development Reference
In-Depth Information
Objective Complete - Mini Debriefing
Basically, what we have done here is create the
GUISkin
asset as the skin for our menu.
First, we tell the GUI that we will use the font name
Federation Kalin
as our main
font for this GUI Skin by seing up the
Font
in the first line in this skin inspector. Then, we
changed all the default skin textures to use our UI graphics from our
UI
folder by seing
all the necessary properies and parameters in
Box
,
Label
,
Window
,
Horizontal Scrollbar
,
Horizontal Scrollbar Thumb
,
Horizontal Scrollbar Left Button
,
Horizontal Scrollbar Right
Button
,
Vertical Scrollbar
,
Vertical Scrollbar Thumb
,
Vertical Scrollbar Up Button
,
Vertical
Scrollbar Down Button
style. Then, we created six
Custom Styles
,
Tab Button
,
Exit Button
,
Text Item
,
Text Amount
,
Selected Item
, and
Disabled Click
, which will be used in our script
in the next secion.
The
Custom Style
is basically the
GUIStyle
that we can add into our
GUISkin
.
This
Style
allows us to create a custom
Style
that will act differently from the
default style (
Box
,
Label
,
Window
, and so on) in this
GUISkin
.
Classified Intel
In this secion, we applied UI graphics to
GUISkin.
You might have a quesion here—how
does it work? Here, we will go through the basic concept of how to create a custom UI in
Photoshop and get the right texture to use in our
GUISkin
.
First, let's take a look at the
myWindow.png
in our
Chapter2/UI
folder. We will see the
capsule shape. You might be curious—how are we going to create a window graphics with
this capsule shape? Well, the trick is the properies
Border
on which we set the parameters
Left
,
Right
,
Top
, and
Bottom
. As we already menioned, use the repeaing image in the
background of the HTML code.
Here is how the Unity
GUIStyle
works. Take a look at the following figure: