# int2

> A 2 component vector of ints.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.Mathematics](/engine/6000.6/script-reference/unity/mathematics.md)
* **Assembly:** UnityEngine.MathematicsModule
* **Implements:** [IEquatable\<int2>](https://learn.microsoft.com/dotnet/api/system.iequatable-1), [IFormattable](https://learn.microsoft.com/dotnet/api/system.iformattable)

```csharp
public struct int2 : IEquatable<int2>, IFormattable
```

## Fields

| Value                                                            | Description                |
| ---------------------------------------------------------------- | -------------------------- |
| [x](/engine/6000.6/script-reference/unity/mathematics/int2/x.md) | x component of the vector. |
| [y](/engine/6000.6/script-reference/unity/mathematics/int2/y.md) | y component of the vector. |

## Static Fields

| Value                                                                  | Description      |
| ---------------------------------------------------------------------- | ---------------- |
| [zero](/engine/6000.6/script-reference/unity/mathematics/int2/zero.md) | int2 zero value. |

## Constructors

| Constructor                                                                                                       | Description                                                                                                      |
| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| [int2(System.Boolean)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(bool\))               | Constructs a int2 vector from a single bool value by converting it to int and assigning it to every component.   |
| [int2(System.Double)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(double\))              | Constructs a int2 vector from a single double value by converting it to int and assigning it to every component. |
| [int2(System.Int32)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(int\))                  | Constructs a int2 vector from a single int value by assigning it to every component.                             |
| [int2(System.Int32,System.Int32)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(int-int\)) | Constructs a int2 vector from two int values.                                                                    |
| [int2(System.Single)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(float\))               | Constructs a int2 vector from a single float value by converting it to int and assigning it to every component.  |
| [int2(System.UInt32)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(uint\))                | Constructs a int2 vector from a single uint value by converting it to int and assigning it to every component.   |
| [int2(Unity.Mathematics.bool2)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(bool2\))     | Constructs a int2 vector from a bool2 vector by componentwise conversion.                                        |
| [int2(Unity.Mathematics.double2)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(double2\)) | Constructs a int2 vector from a double2 vector by componentwise conversion.                                      |
| [int2(Unity.Mathematics.float2)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(float2\))   | Constructs a int2 vector from a float2 vector by componentwise conversion.                                       |
| [int2(Unity.Mathematics.int2)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(int2\))       | Constructs a int2 vector from an int2 vector.                                                                    |
| [int2(Unity.Mathematics.uint2)](/engine/6000.6/script-reference/unity/mathematics/int2/ctor.md#int2\(uint2\))     | Constructs a int2 vector from a uint2 vector by componentwise conversion.                                        |

## Properties

| Property                                                                   | Description                                   |
| -------------------------------------------------------------------------- | --------------------------------------------- |
| [this\[\]](/engine/6000.6/script-reference/unity/mathematics/int2/item.md) | Returns the int element at a specified index. |
| [xx](/engine/6000.6/script-reference/unity/mathematics/int2/xx.md)         | Swizzles the vector.                          |
| [xxx](/engine/6000.6/script-reference/unity/mathematics/int2/xxx.md)       | Swizzles the vector.                          |
| [xxxx](/engine/6000.6/script-reference/unity/mathematics/int2/xxxx.md)     | Swizzles the vector.                          |
| [xxxy](/engine/6000.6/script-reference/unity/mathematics/int2/xxxy.md)     | Swizzles the vector.                          |
| [xxy](/engine/6000.6/script-reference/unity/mathematics/int2/xxy.md)       | Swizzles the vector.                          |
| [xxyx](/engine/6000.6/script-reference/unity/mathematics/int2/xxyx.md)     | Swizzles the vector.                          |
| [xxyy](/engine/6000.6/script-reference/unity/mathematics/int2/xxyy.md)     | Swizzles the vector.                          |
| [xy](/engine/6000.6/script-reference/unity/mathematics/int2/xy.md)         | Swizzles the vector.                          |
| [xyx](/engine/6000.6/script-reference/unity/mathematics/int2/xyx.md)       | Swizzles the vector.                          |
| [xyxx](/engine/6000.6/script-reference/unity/mathematics/int2/xyxx.md)     | Swizzles the vector.                          |
| [xyxy](/engine/6000.6/script-reference/unity/mathematics/int2/xyxy.md)     | Swizzles the vector.                          |
| [xyy](/engine/6000.6/script-reference/unity/mathematics/int2/xyy.md)       | Swizzles the vector.                          |
| [xyyx](/engine/6000.6/script-reference/unity/mathematics/int2/xyyx.md)     | Swizzles the vector.                          |
| [xyyy](/engine/6000.6/script-reference/unity/mathematics/int2/xyyy.md)     | Swizzles the vector.                          |
| [yx](/engine/6000.6/script-reference/unity/mathematics/int2/yx.md)         | Swizzles the vector.                          |
| [yxx](/engine/6000.6/script-reference/unity/mathematics/int2/yxx.md)       | Swizzles the vector.                          |
| [yxxx](/engine/6000.6/script-reference/unity/mathematics/int2/yxxx.md)     | Swizzles the vector.                          |
| [yxxy](/engine/6000.6/script-reference/unity/mathematics/int2/yxxy.md)     | Swizzles the vector.                          |
| [yxy](/engine/6000.6/script-reference/unity/mathematics/int2/yxy.md)       | Swizzles the vector.                          |
| [yxyx](/engine/6000.6/script-reference/unity/mathematics/int2/yxyx.md)     | Swizzles the vector.                          |
| [yxyy](/engine/6000.6/script-reference/unity/mathematics/int2/yxyy.md)     | Swizzles the vector.                          |
| [yy](/engine/6000.6/script-reference/unity/mathematics/int2/yy.md)         | Swizzles the vector.                          |
| [yyx](/engine/6000.6/script-reference/unity/mathematics/int2/yyx.md)       | Swizzles the vector.                          |
| [yyxx](/engine/6000.6/script-reference/unity/mathematics/int2/yyxx.md)     | Swizzles the vector.                          |
| [yyxy](/engine/6000.6/script-reference/unity/mathematics/int2/yyxy.md)     | Swizzles the vector.                          |
| [yyy](/engine/6000.6/script-reference/unity/mathematics/int2/yyy.md)       | Swizzles the vector.                          |
| [yyyx](/engine/6000.6/script-reference/unity/mathematics/int2/yyyx.md)     | Swizzles the vector.                          |
| [yyyy](/engine/6000.6/script-reference/unity/mathematics/int2/yyyy.md)     | Swizzles the vector.                          |

## Methods

| Method                                                                               | Description                                                         |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| [Equals](/engine/6000.6/script-reference/unity/mathematics/int2/equals.md)           | Returns true if the int2 is equal to a given int2, false otherwise. |
| [GetHashCode](/engine/6000.6/script-reference/unity/mathematics/int2/gethashcode.md) | Returns a hash code for the int2.                                   |
| [ToString](/engine/6000.6/script-reference/unity/mathematics/int2/tostring.md)       | Returns a string representation of the int2.                        |

## Operators

| Operator                                                                                       | Description                                                                                                                  |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| [operator +](/engine/6000.6/script-reference/unity/mathematics/int2/op-addition.md)            | Returns the result of a componentwise addition operation on an int value and an int2 vector.                                 |
| [operator &](/engine/6000.6/script-reference/unity/mathematics/int2/op-bitwiseand.md)          | Returns the result of a componentwise bitwise and operation on an int value and an int2 vector.                              |
| [operator \|](/engine/6000.6/script-reference/unity/mathematics/int2/op-bitwiseor.md)          | Returns the result of a componentwise bitwise or operation on an int value and an int2 vector.                               |
| [operator --](/engine/6000.6/script-reference/unity/mathematics/int2/op-decrement.md)          | Returns the result of a componentwise decrement operation on an int2 vector.                                                 |
| [operator /](/engine/6000.6/script-reference/unity/mathematics/int2/op-division.md)            | Returns the result of a componentwise division operation on an int value and an int2 vector.                                 |
| [operator ==](/engine/6000.6/script-reference/unity/mathematics/int2/op-equality.md)           | Returns the result of a componentwise equality operation on an int value and an int2 vector.                                 |
| [operator ^](/engine/6000.6/script-reference/unity/mathematics/int2/op-exclusiveor.md)         | Returns the result of a componentwise bitwise exclusive or operation on an int value and an int2 vector.                     |
| [int2](/engine/6000.6/script-reference/unity/mathematics/int2/op-explicit.md)                  | Explicitly converts a single bool value to a int2 vector by converting it to int and assigning it to every component.        |
| [operator >](/engine/6000.6/script-reference/unity/mathematics/int2/op-greaterthan.md)         | Returns the result of a componentwise greater than operation on an int value and an int2 vector.                             |
| [operator >=](/engine/6000.6/script-reference/unity/mathematics/int2/op-greaterthanorequal.md) | Returns the result of a componentwise greater or equal operation on an int value and an int2 vector.                         |
| [operator ++](/engine/6000.6/script-reference/unity/mathematics/int2/op-increment.md)          | Returns the result of a componentwise increment operation on an int2 vector.                                                 |
| [operator !=](/engine/6000.6/script-reference/unity/mathematics/int2/op-inequality.md)         | Returns the result of a componentwise not equal operation on an int value and an int2 vector.                                |
| [operator \<\<](/engine/6000.6/script-reference/unity/mathematics/int2/op-leftshift.md)        | Returns the result of a componentwise left shift operation on an int2 vector by a number of bits specified by a single int.  |
| [operator \<](/engine/6000.6/script-reference/unity/mathematics/int2/op-lessthan.md)           | Returns the result of a componentwise less than operation on an int value and an int2 vector.                                |
| [operator \<=](/engine/6000.6/script-reference/unity/mathematics/int2/op-lessthanorequal.md)   | Returns the result of a componentwise less or equal operation on an int value and an int2 vector.                            |
| [operator %](/engine/6000.6/script-reference/unity/mathematics/int2/op-modulus.md)             | Returns the result of a componentwise modulus operation on an int value and an int2 vector.                                  |
| [operator \*](/engine/6000.6/script-reference/unity/mathematics/int2/op-multiply.md)           | Returns the result of a componentwise multiplication operation on an int value and an int2 vector.                           |
| [operator \~](/engine/6000.6/script-reference/unity/mathematics/int2/op-onescomplement.md)     | Returns the result of a componentwise bitwise not operation on an int2 vector.                                               |
| [operator >>](/engine/6000.6/script-reference/unity/mathematics/int2/op-rightshift.md)         | Returns the result of a componentwise right shift operation on an int2 vector by a number of bits specified by a single int. |
| [operator -](/engine/6000.6/script-reference/unity/mathematics/int2/op-subtraction.md)         | Returns the result of a componentwise subtraction operation on an int value and an int2 vector.                              |
