Version: Unity 6.5 Alpha (6000.5)
LanguageEnglish
  • C#

math.abs

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static int abs(int x);

Parameters

Parameter Description
x Input value.

Returns

int The absolute value of the input.

Description

Returns the absolute value of a int value.


Declaration

public static int2 abs(int2 x);

Parameters

Parameter Description
x Input value.

Returns

int2 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a int2 vector.


Declaration

public static int3 abs(int3 x);

Parameters

Parameter Description
x Input value.

Returns

int3 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a int3 vector.


Declaration

public static int4 abs(int4 x);

Parameters

Parameter Description
x Input value.

Returns

int4 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a int4 vector.


Declaration

public static long abs(long x);

Parameters

Parameter Description
x Input value.

Returns

long The absolute value of the input.

Description

Returns the absolute value of a long value.


Declaration

public static float abs(float x);

Parameters

Parameter Description
x Input value.

Returns

float The absolute value of the input.

Description

Returns the absolute value of a float value.


Declaration

public static float2 abs(float2 x);

Parameters

Parameter Description
x Input value.

Returns

float2 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a float2 vector.


Declaration

public static float3 abs(float3 x);

Parameters

Parameter Description
x Input value.

Returns

float3 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a float3 vector.


Declaration

public static float4 abs(float4 x);

Parameters

Parameter Description
x Input value.

Returns

float4 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a float4 vector.


Declaration

public static double abs(double x);

Parameters

Parameter Description
x Input value.

Returns

double The absolute value of the input.

Description

Returns the absolute value of a double value.


Declaration

public static double2 abs(double2 x);

Parameters

Parameter Description
x Input value.

Returns

double2 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a double2 vector.


Declaration

public static double3 abs(double3 x);

Parameters

Parameter Description
x Input value.

Returns

double3 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a double3 vector.


Declaration

public static double4 abs(double4 x);

Parameters

Parameter Description
x Input value.

Returns

double4 The componentwise absolute value of the input.

Description

Returns the componentwise absolute value of a double4 vector.