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 2D space. This is useful for operations that require a standard upward direction, such as movement or alignment in a 2D plane.

Usage

Use Vector2.Up when you need a consistent reference for the upward direction in 2D space. This can be particularly useful in game development for defining movement directions or aligning objects.

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;