Game Development Reference
In-Depth Information
Note: The
Mask
requires an
Image
or other
Visual
component in
order to mask the child area. Having a
Mask
on its own without an
additional component that uses the
Canvas
layout won't work and
will not mask the area.
If you add a
Mask
component to the
ScrollRectArea
GameObject from the previous
example (and an
Image
component without setting a
Source Image
, as the
Mask
requires a
Graphic
component), then it would only show the
Content
area within the
bounds of the
ScrollRectArea
GameObject's
Rect Transform
as seen here:
Resolution and scaling
Since there has been a
UI
and the need to display on more than one type of screen
(basically since the days of arcade when you knew what you were running on), there
has always been the challenge how to best design and implement a good
UI
that will
work on any resolution, especially in Unity!
We will just cover the basics in this section, and full examples will be
given in
Chapter 4
,
Anchors Away
when we cover building responsive
layouts with
Anchors
.
To answer this call with the new
Unity UI
system, Unity has created a resolution
scaling component that is attached to a
Canvas
by default in order to control
the resolution-based drawing of the GameObjects and components within; this
component is called the
Canvas Scaler
.