Game Development Reference
In-Depth Information
•
Scroll Sensitivity
: Scales the input from scroll devices such as a mouse wheel
or track pad scroll.
•
Scrollbars
: As well as the normal grabbing of the scrollable area, you can also
attach scrollbars to the
Scroll Rect
to give a visual indication of how large the
area is, both
Horizontally
and
Vertically
.
To apply
Scroll Bars
, simply add them to your scene like any other
UI
component and then drag your relevant
Vertical
or
Horizontal
Scrollbar
to the relevant property in the
Scroll Rect
component. More
on this later in
Chapter 3,
Control, Control, You Must Learn Control
.
So the
Scroll Rect
provides us a way to scroll over larger content than we can see on
the screen, as shown here:
A basic Scroll Rect example
If you want to also restrict the visible area of the
Scroll Rect
, then we also need
a
Mask
.
Masks
A welcome addition to the
Unity UI
arsenal is the
Mask
component. In short, it
limits the drawing of child components to the
Rect Transform
of the GameObject it
is attached to. It is very basic and very easy to use.