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

math.length

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 float length(float x);

Parameters

Parameter Description
x Value to use when computing length.

Returns

float Length of x.

Description

Returns the length of a float value. Equivalent to the absolute value.


Declaration

public static float length(float2 x);

Parameters

Parameter Description
x Vector to use when computing length.

Returns

float Length of vector x.

Description

Returns the length of a float2 vector.


Declaration

public static float length(float3 x);

Parameters

Parameter Description
x Vector to use when computing length.

Returns

float Length of vector x.

Description

Returns the length of a float3 vector.


Declaration

public static float length(float4 x);

Parameters

Parameter Description
x Vector to use when computing length.

Returns

float Length of vector x.

Description

Returns the length of a float4 vector.


Declaration

public static double length(double x);

Parameters

Parameter Description
x Value to use when computing squared length.

Returns

double Squared length of x.

Description

Returns the length of a double value. Equivalent to the absolute value.


Declaration

public static double length(double2 x);

Parameters

Parameter Description
x Vector to use when computing squared length.

Returns

double Squared length of vector x.

Description

Returns the length of a double2 vector.


Declaration

public static double length(double3 x);

Parameters

Parameter Description
x Vector to use when computing squared length.

Returns

double Squared length of vector x.

Description

Returns the length of a double3 vector.


Declaration

public static double length(double4 x);

Parameters

Parameter Description
x Vector to use when computing squared length.

Returns

double Squared length of vector x.

Description

Returns the length of a double4 vector.


Declaration

public static float length(quaternion q);

Parameters

Parameter Description
q The input quaternion.

Returns

float The length of the input quaternion.

Description

Returns the length of a quaternion.