Description
The Vector2Int.One
field is a static, public field of the Vector2Int
struct. It represents an integer vector where both the X and Y components are set to 1. This field is useful for operations where a unit vector with integer components is required.
Usage
You can use Vector2Int.One
whenever you need a vector with both components set to 1. This is particularly useful in scenarios where you need to initialize or compare vectors with a standard unit vector in integer space.
Example
// Example of using Vector2Int.One
Vector2Int unitVector = Vector2Int.One;
// Output the components of the unit vector
int xComponent = unitVector.x; // 1
int yComponent = unitVector.y; // 1
// Use in a function
Vector2Int result = SomeFunction(Vector2Int.One);
// Example function that might use Vector2Int.One
Vector2Int SomeFunction(Vector2Int input)
{
// Perform operations with the input vector
return input + new Vector2Int(2, 3);
}