RectInt
A 2D Rectangle defined by x, y, width, height with integers.
Read time 2 minutesLast updated 4 days ago
Definition
- Type: Struct
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
- Implements: IEquatable<RectInt>, IFormattable
public struct RectInt : IEquatable<RectInt>, IFormattable
Constructors
Constructor | Description |
|---|---|
| RectInt(System.Int32,System.Int32,System.Int32,System.Int32) | Creates a new RectInt. |
| RectInt(UnityEngine.Vector2Int,UnityEngine.Vector2Int) | Creates a new RectInt. |
| RectInt(UnityEngine.Vector2Int@,UnityEngine.Vector2Int@) | Creates a new RectInt. |
Properties
Property | Description |
|---|---|
| allPositionsWithin | A PositionCollection that contains all positions within the RectInt. |
| center | Center coordinate of the rectangle. |
| height | Height of the rectangle. |
| max | The upper right corner of the rectangle; which is the maximal position of the rectangle along the x- and y-axes, when it is aligned to both axes. |
| min | The lower left corner of the rectangle; which is the minimal position of the rectangle along the x- and y-axes, when it is aligned to both axes. |
| position | Returns the position (x, y) of the |
| size | Returns the width and height of the |
| width | Width of the rectangle. |
| x | Left coordinate of the rectangle. |
| xMax | Shows the maximum X value of the |
| xMin | Shows the minimum X value of the |
| y | Top coordinate of the rectangle. |
| yMax | Shows the maximum Y value of the |
| yMin | Show the minimum Y value of the |
Static Properties
Property | Description |
|---|---|
| zero | Shorthand for writing |
Methods
Method | Description |
|---|---|
| ClampToBounds | Clamps the position and size of the |
| Contains | Returns true if the given position is within the RectInt. |
| Equals | Returns true if the given RectInt is equal to this RectInt. |
| Overlaps | RectInts overlap if each RectInt RectInt.Contains a shared point. |
| SetMinMax | Sets the bounds to the |
| ToString | Returns the x, y, width and height of the |
Operators
Operator | Description |
|---|---|
| operator == | Returns true if the rectangles are the same. |
Structs
Struct | Description |
|---|---|
| RectInt.PositionEnumerator | An iterator that allows you to iterate over all positions within the RectInt. |