Description
The Vector2Int.Up
field is a static, read-only field of the Vector2Int
struct. It represents a 2D vector pointing upwards, with the Y component set to 1 and the X component set to 0. This field is useful for operations that require a standard upward direction in a 2D space, such as movement or alignment calculations.
Usage
Use Vector2Int.Up
when you need a consistent reference to the upward direction in 2D integer vector operations. This can be particularly useful in game development for defining movement directions or aligning objects.
Example
// Example of using Vector2Int.Up
Vector2Int position = new Vector2Int(5, 5);
Vector2Int newPosition = position + Vector2Int.Up;
// newPosition will be (5, 6)