The x
property of the Vector2
struct represents the X component of a 2-dimensional vector. This component is typically used to denote the horizontal position or size in a 2D space.
The x
property of the Vector2
struct represents the X component of a 2-dimensional vector. This component is typically used to denote the horizontal position or size in a 2D space.
Use the x
property to get or set the horizontal component of a Vector2
instance. This property is a float
and can be accessed directly.
// Example of using the x property Vector2 position = new Vector2(); position.x = 10.0f; // Accessing the x component float xValue = position.x; // Output the x component // Note: Avoid using Console.WriteLine in s&box // Instead, use logging or debugging tools provided by the engine // Log.Info($"X Component: {xValue}");