Description
The WithX
method of the Vector3Int
struct allows you to create a new Vector3Int
instance with a specified X component, while retaining the Y and Z components of the original vector. This method is useful when you need to modify only the X component of a vector without affecting the other components.
Usage
To use the WithX
method, call it on an existing Vector3Int
instance and pass the new X value as an argument. The method returns a new Vector3Int
with the updated X component.
Example
Vector3Int originalVector = new Vector3Int(1, 2, 3);
Vector3Int newVector = originalVector.WithX(5);
// newVector is now (5, 2, 3)