Rect structure is mainly used for 2D operations. The UnityGUI system uses it extensively
and it is also to set the onscreen position of a Camera's view.
The rectangle can be specified in two different ways. The first way involves
supplying the top-left corner coordinate along with the width and height. This is
done using the x
The second way to specify the rectangle is to supply the X coordinates of its left
and right sides and the Y coordinates of its top and bottom sides. These are denoted
by the xMin
Although the x
properties may seem to be the same as
, their behaviour is actually slightly different.
values are assumed to be used along with
means that if you change
rectangle will change position but stay the same size. On the other hand, if you change
the values of
then the rectangle will
change size and the top-left corner will also change.
See Also: GUI Scripting Guide