Game Development Reference
In-Depth Information
Overview
In Chapter 1 , Looking Back, Looking Forward , I gave you a rundown of all the new
controls available in the new UI framework, namely:
• The Text control
• The Image and RawImage controls
• A Button control
• A Toggle control
• The Scrollbar and Slider controls
It may not sound like much (compared to the larger array of controls in the legacy
GUI), but as you'll discover, it's all you really need as a base (especially when you
combine them with all the other features of the new UI).
Beyond that, Unity also provides you with a fully extensible framework used to
craft your own controls with events, structures, and design patterns to enable just
about whatever you can dream up. You can even use another component called
the Selectable component, that can be added to just about any other GameObject
(on a Canvas) to enable user interaction.
Enough preamble, let's play.
Note: If you draw a RectTransform with a negative width or negative
height, then UI controls will not be drawn. You can rotate the control
in whichever direction you wish to alter how it is drawn in the scene
(including reversed, as UI controls are two-sided textures) but the base
RectTransform must always be drawn in a positive direction.
A word on code
Starting simple, we'll just play around with the controls in this chapter through the
editor, with some code where it adds value to explain things.
We'll delve into building and using the controls through code in later chapters,
including building controls with the event interfaces.
 
Search WWH ::




Custom Search