Game Development Reference
In-Depth Information
This will reposition the Anchor for the
Slider
to the
top
and
left
corner of
the
Canvas
.
If you also hold down the
ALT
key when selecting
Anchor Preset
,
it will additionally reposition the
Slider
control to the top-left
corner of the
Canvas
as well.
So what did this actually do for us? Couldn't we have just moved the
Rect
Transform
of the
Slider
to the top-left corner?
Well, let's examine that. If we leave the
Anchor
at the center of the screen and just
move the
Slider
to the top-left of the screen, then when the screen is resized down,
the slider will retain the same distance from the center as it did before. This now
results in the
Slider
being drawn off the screen, as you can see here:
Screen width resized down - without being Anchored, the slider does not move
It is worth pointing out that the
Anchor
holds the position of the UI
directly to its
Pivot
point, not an edge or corner.