The y
property of the Vector2
struct represents the Y component of a 2-dimensional vector. This property is a floating-point value that can be used to access or modify the Y coordinate of the vector.
The y
property of the Vector2
struct represents the Y component of a 2-dimensional vector. This property is a floating-point value that can be used to access or modify the Y coordinate of the vector.
Use the y
property to get or set the Y component of a Vector2
instance. This is useful when you need to manipulate or retrieve the vertical component of a vector in 2D space.
// Example of using the y property Vector2 position = new Vector2(3.0f, 4.0f); // Access the y component float yValue = position.y; // Modify the y component position.y = 5.0f; // Output the updated vector Vector2 updatedPosition = position; // updatedPosition is now (3.0f, 5.0f)