Description
The Vector2.One
property provides a static instance of a 2D vector where both the X and Y components are set to 1. This is useful for scenarios where a unit vector with equal components is required, such as scaling operations or initializing vectors to a default state.
Usage
Use Vector2.One
when you need a vector with both components set to 1. This can be particularly useful in mathematical operations where a uniform scale or offset is needed.
Example
// Example of using Vector2.One
Vector2 unitVector = Vector2.One;
// This will output: (1, 1)
Debug.Log($"Unit Vector: {unitVector}");
// Using Vector2.One in a scaling operation
Vector2 scale = new Vector2(2, 3);
Vector2 scaledVector = scale * Vector2.One;
// This will output: (2, 3)
Debug.Log($"Scaled Vector: {scaledVector}");