float y { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

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.

Usage

To access or modify the Y component of a Vector2 instance, use the y property. This property is read-write, allowing you to both retrieve the current Y value and assign a new one.

Example

// Example of using the y property
Vector2 position = new Vector2();
position.y = 10.0f; // Set the Y component
float currentY = position.y; // Get the Y component

// Output the Y component
// Note: Avoid using Console.WriteLine in s&box
// Instead, use in-game debugging tools or UI elements
// Debug.Log(currentY); // Hypothetical example for in-game logging