Vector2Int
Representation of 2D vectors and points using integers.
Read time 2 minutesLast updated 6 days ago
Definition
public struct Vector2Int : IEquatable<Vector2Int>, IFormattable
This structure is used in some places to represent 2D positions and vectors that don't require the precision of floating-point.
Properties
Property | Description |
|---|
| this[] | Access the or component using [0] or [1] respectively. |
| magnitude | Returns the length of this vector (Read Only). |
| sqrMagnitude | Returns the squared length of this vector (Read Only). |
| x | X component of the vector. |
| y | Y component of the vector. |
Static Properties
Property | Description |
|---|
| down | Shorthand for writing . |
| left | Shorthand for writing . |
| one | Shorthand for writing . |
| right | Shorthand for writing . |
| up | Shorthand for writing . |
| zero | Shorthand for writing . |
Methods
Method | Description |
|---|
| Clamp | Clamps the to the bounds given by and . |
| Equals | Evaluates if a vector and obejct are equal to each other. |
| GetHashCode | Gets the hash code for the . |
| Scale | Multiplies every component of this vector by the same component of . |
| Set | Set x and y components of an existing Vector2Int. |
| ToString | Formats this vector as a string. |
Static Methods
Operators