Game Development Reference
In-Depth Information
For the controls, you are using GUI.Label and GUI.HorizontalSlider. Note how the slider values set
themselves recursively. The slider ranges are set in the controls, but the default values are read from
the variable declarations.
1.
Save the script.
2.
Drag it onto the Settings Menu object.
3.
Drag the SubMenu GUISkin onto its New Skin parameter.
4.
Click Play, and check out the menu.
The Label is in dire need of adjustment.
5.
Expand the Label template.
6.
Set its Normal Text Color to black.
7.
Set its Font to None, its Font Size to 22, and its Font Style to Bold.
8.
Set its Alignment to Middle Center.
The label text is back under control.
Here comes the fun part. The sliders are looking okay, but you can have a bit of fun with the
indicators.
1.
Expand the Horizontal Slider Thumb template.
2.
For its Normal background image, select CarrotThumb.
3.
For its Hover background image, select CarrotThumb_Hover.
4.
For its Active background image, select CarrotThumb_Active.
5.
Set the Fixed Width to 25 and the Fixed Height to 50 .
6.
Under Overflow, set the Top to 10 .
With the skin elements locked down, you can experiment with the sliders to see how the different
images are used during interaction.
Just above the // ambient volume slider line, subtract 25 from the offset to
improve the spacing:
7.
y+= yOffset - 25;
8.
Stop Play mode.
9.
Add a few prefab objects if you wish.
The Settings menu is ready for interaction (Figure 10-37 ).
 
Search WWH ::




Custom Search