static Vector2Int Max( Vector2Int a, Vector2Int b )

book_4_sparkGenerated
code_blocksInput

Description

The Max method in the Vector2Int struct is a static method that returns a new Vector2Int instance. This instance contains the maximum values of the corresponding components from two given Vector2Int instances. It compares the x and y components of the two vectors and selects the larger value for each component.

Usage

Use the Max method when you need to determine the maximum component values between two Vector2Int instances. This can be useful in scenarios where you want to ensure that a vector's components are at least as large as those of another vector.

To use this method, simply call it with two Vector2Int instances as arguments. The method will return a new Vector2Int with the maximum values for each component.

Example

// Example usage of Vector2Int.Max method
Vector2Int vectorA = new Vector2Int(3, 5);
Vector2Int vectorB = new Vector2Int(4, 2);

Vector2Int maxVector = Vector2Int.Max(vectorA, vectorB);
// maxVector will be (4, 5)