Description
The WithY
method of the Vector2Int
struct allows you to create a new Vector2Int
instance with a specified Y component, while keeping the X component unchanged. This method is useful when you need to modify only the Y component of a vector without affecting its X component.
Usage
To use the WithY
method, call it on an existing Vector2Int
instance and pass the new Y value as an integer parameter. The method returns a new Vector2Int
with the updated Y value.
Example
Vector2Int originalVector = new Vector2Int(3, 5);
Vector2Int newVector = originalVector.WithY(10);
// newVector is now (3, 10)