Version: 5.3 (switch to 5.4b)
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.


struct in UnityEngine

Suggest a change


Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.


Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.



Switch to Manual


x, y 위치와 넓이, 높이에 의해 정의되는 2차원 사각형 영역(rectangle)을 나타냅니다.

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.

The following examples are illustrated in GUI space, where (0,0) represents the top-left corner and Y increases downwards.

화면상의 카메라 위치를 조절하는데에도 사용한다.

The other way is with the X and Y coordinates of each of its edges. These are called xMin, xMax, yMin and yMax:

Note that although x and y have the same values as xMin and yMin, they behave differently when you set them. Setting x or y changes the position of the rectangle, but preserves its size:

Setting any of xMin, xMax, yMin and yMax will resize the rectangle, but preserve the position of the opposite edge:

See Also: GUI Scripting Guide, Camera.rect, Camera.pixelRect.


centerrectangle의 왼쪽 상단 좌표를 나타냅니다.
heightThe height of the rectangle, measured from the Y position.
maxrectangle의 왼쪽 상단 좌표를 나타냅니다.
minrectangle의 왼쪽 상단 좌표를 나타냅니다.
positionrectangle의 크기를 나타냅니다.
sizerectangle의 크기를 나타냅니다.
widthThe width of the rectangle, measured from the X position.
xrectangle의 위의 좌표를 나타냅니다.
xMaxrectangle의 위의 좌표를 나타냅니다.
xMinrectangle의 위의 좌표를 나타냅니다.
yrectangle의 위의 좌표를 나타냅니다.
yMaxrectangle의 위의 좌표를 나타냅니다.
yMinrectangle의 위의 좌표를 나타냅니다.


RectCreates a new rectangle.

Public Functions

Contains y의 y와 y 컴포넌트가 이 사각형의 점이면 true를 반환합니다. /allowInverse/가 있으면 true이고, Rect의 width와 height는 음수를 가질수 있습니다.(즉, 최소값이 최대값보다 클수 있습니다.)
Overlaps다른 Rect가 이것을 오버랩하면 true를 반환하고, /allowInverse/가 존재하면 true, Rect의 width와 height는 음수를 가질수 있습니다.(즉, 최소값이 최대값보다 클수 있습니다.)
SetRect의 컴포넌트를 설정합니다.
ToStringReturns a nicely formatted string for this Rect.

Static Functions

MinMaxRect최대/최소 좌표 값으로 Rect를 생성합니다.
NormalizedToPointReturns a point inside a rectangle, given normalized coordinates.
PointToNormalizedReturns the normalized coordinates cooresponding the the point.


operator !=Returns true if the rectangles are different.
operator ==Returns true if the rectangles are the same.