Vector3Int WithY( int y )

book_4_sparkGenerated
code_blocksInput

Description

The WithY method of the Vector3Int struct allows you to create a new Vector3Int instance with a specified Y component, while keeping the X and Z components unchanged from the original vector.

Usage

Use this method when you need to modify the Y component of a Vector3Int without altering its X and Z components. This is useful in scenarios where you want to adjust the vertical position or height of a vector while maintaining its horizontal position.

Example

Vector3Int originalVector = new Vector3Int(1, 2, 3);
Vector3Int newVector = originalVector.WithY(5);
// newVector is now (1, 5, 3)