Vector2 Up { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Vector2.Up property provides a static 2D vector with the Y component set to 1, representing the upwards direction in a 2D coordinate system. This is useful for operations that require a standard upward direction, such as moving an object upwards or defining a default orientation.

Usage

Use Vector2.Up when you need a consistent reference to the upward direction in 2D space. This property is static, so it can be accessed directly from the Vector2 class without needing to instantiate an object.

Example

// Example of using Vector2.Up
Vector2 direction = Vector2.Up;

// Use the direction to move an object upwards
GameObject player = new GameObject();
player.Position += direction * speed * Time.Delta;