Game Development Reference
In-Depth Information
Save the script, save the scene, and playtest to watch the horizontal and vertical slider values
change when you move their respective knobs.
At this point the Game view is getting pretty crowded (Figure 11-4 ).
Figure 11-4. Assorted sample controls in the Game view
This is a great example of what not to do—too many controllers reduce the player's ability to see
the game, and can detract from the gameplay experience when not implemented properly. The
use of game controls should be determined in the game design phase, long before you sit down to
the computer. Whether you use controls for maps, inventories, scores, ammo, health, or whatever
information you would like to impart to the player, be as efficient as possible.
In this example, the only control that is pertinent to the Obstacle Course prototype is the fading
label. You could have put the code for all of the sample controllers into one script, but creating a
few helps keep your sample code organized and now allows you to select the GUI game object and
disable all of the scripts except the GUIScript. Save the scene and playtest, and only the fading label
remains.
Unity provides a broad range of GUI methods from GUI.SelectionGrid , which functions as a
multirow toolbar for GUI.changed to quickly test if the reader has interacted with any of the controls.
Unity also has more advanced controls such as compound controls, scroll views, and windows. If
your GUI requires something more complex, you can always dig into the documentation and see
what more Unity has to assist you.
 
Search WWH ::




Custom Search