x、y、width、height 変数によって定義される 2 次元範囲です。
Unity uses a number of 2D coordinate spaces, most of which define X as increasing to the right, and Y increasing upwards.
The one exception is in the GUI and GUILayout classes, where Y increases downwards.
以下の例は GUI 空間を表しており、(0,0) は最上部の左端を示し、Y の値は下に向かって増加します。
矩形は 2 つの方法で指定できます。1 つめは x、y の位置、width、height: で表します。
もう 1 つの方法は、矩形の角のそれぞれの X と Y 座標で表します。それらは、xMin、xMax、yMin、yMax と呼ばれます。x
と y
の値は xMin
と yMin
の値と同じですが、それらは別の使われ方をします。x
または y
を変更すると、矩形の位置は変わりますが、そのサイズは変化しません。yMax
、yMax
、yMax
、yMax
のいずれかを変えると矩形のサイズは変化しますが、反対の端の位置は変わりません。
See Also: GUI Scripting Guide, Camera.rect, Camera.pixelRect.
zero | Shorthand for writing new Rect(0,0,0,0). |
center | 矩形の中心座標 |
height | 矩形の高さ(位置 Y から計測) |
max | 矩形の最大隅の座標 |
min | 矩形の最小隅の座標 |
position | 矩形のX、Y位置 |
size | 矩形の幅と高さ |
width | 矩形の幅(位置 x から計測) |
x | 矩形のX座標 |
xMax | 矩形の最大 X 座標 |
xMin | 矩形の最小 X 座標 |
y | 矩形のY座標 |
yMax | 矩形の最大 Y 座標 |
yMin | 矩形の最小 Y 座標 |
Rect | 新しい矩形を作成します。 |
Contains | X と Y の point が Rect 内にある場合は true を返します もし allowInverse が true の場合、Rect の width と height が負の値でも動作するようになります(例えば最小値が最大値を超えてしまう場合)。 |
Overlaps | 他の矩形がこの矩形に重なっている場合、true を返します allowInverse が存在し、かつ true である場合、Rect の width と height は負数(つまり、最小値 が 最大値 よりも大きい)を取ることができ、判定は依然として動作します。 |
Set | 既存の Rect コンポーネントを設定します |
ToString | Returns a formatted string for this Rect. |
MinMaxRect | 最小/最大の値か Rect クラスを作成します |
NormalizedToPoint | 正規化座標を指定して長方形内部の位置を返します |
PointToNormalized | ポイントに対応する正規化座標を返します |
operator == | 矩形が同じであれば true を返します |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.