Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


float2

A 2 component vector of floats.
Read time 4 minutesLast updated 5 days ago

Definition

public struct float2 : IEquatable<float2>, IFormattable

Fields

Value

Description

xx component of the vector.
yy component of the vector.

Static Fields

Value

Description

zerofloat2 zero value.

Constructors

Constructor

Description

float2(System.Boolean)Constructs a float2 vector from a single bool value by converting it to float and assigning it to every component.
float2(System.Double)Constructs a float2 vector from a single double value by converting it to float and assigning it to every component.
float2(System.Int32)Constructs a float2 vector from a single int value by converting it to float and assigning it to every component.
float2(System.Single)Constructs a float2 vector from a single float value by assigning it to every component.
float2(System.Single,System.Single)Constructs a float2 vector from two float values.
float2(System.UInt32)Constructs a float2 vector from a single uint value by converting it to float and assigning it to every component.
float2(Unity.Mathematics.bool2)Constructs a float2 vector from a bool2 vector by componentwise conversion.
float2(Unity.Mathematics.double2)Constructs a float2 vector from a double2 vector by componentwise conversion.
float2(Unity.Mathematics.float2)Constructs a float2 vector from a float2 vector.
float2(Unity.Mathematics.half)Constructs a float2 vector from a single half value by converting it to float and assigning it to every component.
float2(Unity.Mathematics.half2)Constructs a float2 vector from a half2 vector by componentwise conversion.
float2(Unity.Mathematics.int2)Constructs a float2 vector from a int2 vector by componentwise conversion.
float2(Unity.Mathematics.uint2)Constructs a float2 vector from a uint2 vector by componentwise conversion.

Properties

Property

Description

this[]Returns the float element at a specified index.
xxSwizzles the vector.
xxxSwizzles the vector.
xxxxSwizzles the vector.
xxxySwizzles the vector.
xxySwizzles the vector.
xxyxSwizzles the vector.
xxyySwizzles the vector.
xySwizzles the vector.
xyxSwizzles the vector.
xyxxSwizzles the vector.
xyxySwizzles the vector.
xyySwizzles the vector.
xyyxSwizzles the vector.
xyyySwizzles the vector.
yxSwizzles the vector.
yxxSwizzles the vector.
yxxxSwizzles the vector.
yxxySwizzles the vector.
yxySwizzles the vector.
yxyxSwizzles the vector.
yxyySwizzles the vector.
yySwizzles the vector.
yyxSwizzles the vector.
yyxxSwizzles the vector.
yyxySwizzles the vector.
yyySwizzles the vector.
yyyxSwizzles the vector.
yyyySwizzles the vector.

Methods

Method

Description

EqualsReturns true if the float2 is equal to a given float2, false otherwise.
GetHashCodeReturns a hash code for the float2.
ToStringReturns a string representation of the float2.

Operators

Operator

Description

operator +Returns the result of a componentwise addition operation on a float value and a float2 vector.
operator --Returns the result of a componentwise decrement operation on a float2 vector.
operator /Returns the result of a componentwise division operation on a float value and a float2 vector.
operator ==Returns the result of a componentwise equality operation on a float value and a float2 vector.
float2Explicitly converts a single bool value to a float2 vector by converting it to float and assigning it to every component.
operator >Returns the result of a componentwise greater than operation on a float value and a float2 vector.
operator >=Returns the result of a componentwise greater or equal operation on a float value and a float2 vector.
operator ++Returns the result of a componentwise increment operation on a float2 vector.
operator !=Returns the result of a componentwise not equal operation on a float value and a float2 vector.
operator <Returns the result of a componentwise less than operation on a float value and a float2 vector.
operator <=Returns the result of a componentwise less or equal operation on a float value and a float2 vector.
operator %Returns the result of a componentwise modulus operation on a float value and a float2 vector.
operator *Returns the result of a componentwise multiplication operation on a float value and a float2 vector.
operator -Returns the result of a componentwise subtraction operation on a float value and a float2 vector.