docs.unity.cn
    Show / Hide Table of Contents

    Method sign

    sign(Int32)

    Returns the sign of a int value. -1 if it is less than zero, 0 if it is zero and 1 if it greater than zero.

    Declaration
    public static int sign(int x)
    Parameters
    Type Name Description
    Int32 x

    Input value.

    Returns
    Type Description
    Int32

    The sign of the input.

    sign(int2)

    Returns the componentwise sign of a int2 value. 1 for positive components, 0 for zero components and -1 for negative components.

    Declaration
    public static int2 sign(int2 x)
    Parameters
    Type Name Description
    int2 x

    Input value.

    Returns
    Type Description
    int2

    The componentwise sign of the input.

    sign(int3)

    Returns the componentwise sign of a int3 value. 1 for positive components, 0 for zero components and -1 for negative components.

    Declaration
    public static int3 sign(int3 x)
    Parameters
    Type Name Description
    int3 x

    Input value.

    Returns
    Type Description
    int3

    The componentwise sign of the input.

    sign(int4)

    Returns the componentwise sign of a int4 value. 1 for positive components, 0 for zero components and -1 for negative components.

    Declaration
    public static int4 sign(int4 x)
    Parameters
    Type Name Description
    int4 x

    Input value.

    Returns
    Type Description
    int4

    The componentwise sign of the input.

    sign(Single)

    Returns the sign of a float value. -1.0f if it is less than zero, 0.0f if it is zero and 1.0f if it greater than zero.

    Declaration
    public static float sign(float x)
    Parameters
    Type Name Description
    Single x

    Input value.

    Returns
    Type Description
    Single

    The sign of the input.

    sign(float2)

    Returns the componentwise sign of a float2 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.

    Declaration
    public static float2 sign(float2 x)
    Parameters
    Type Name Description
    float2 x

    Input value.

    Returns
    Type Description
    float2

    The componentwise sign of the input.

    sign(float3)

    Returns the componentwise sign of a float3 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.

    Declaration
    public static float3 sign(float3 x)
    Parameters
    Type Name Description
    float3 x

    Input value.

    Returns
    Type Description
    float3

    The componentwise sign of the input.

    sign(float4)

    Returns the componentwise sign of a float4 value. 1.0f for positive components, 0.0f for zero components and -1.0f for negative components.

    Declaration
    public static float4 sign(float4 x)
    Parameters
    Type Name Description
    float4 x

    Input value.

    Returns
    Type Description
    float4

    The componentwise sign of the input.

    sign(Double)

    Returns the sign of a double value. -1.0 if it is less than zero, 0.0 if it is zero and 1.0 if it greater than zero.

    Declaration
    public static double sign(double x)
    Parameters
    Type Name Description
    Double x

    Input value.

    Returns
    Type Description
    Double

    The sign of the input.

    sign(double2)

    Returns the componentwise sign of a double2 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.

    Declaration
    public static double2 sign(double2 x)
    Parameters
    Type Name Description
    double2 x

    Input value.

    Returns
    Type Description
    double2

    The componentwise sign of the input.

    sign(double3)

    Returns the componentwise sign of a double3 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.

    Declaration
    public static double3 sign(double3 x)
    Parameters
    Type Name Description
    double3 x

    Input value.

    Returns
    Type Description
    double3

    The componentwise sign of the input.

    sign(double4)

    Returns the componentwise sign of a double4 value. 1.0 for positive components, 0.0 for zero components and -1.0 for negative components.

    Declaration
    public static double4 sign(double4 x)
    Parameters
    Type Name Description
    double4 x

    Input value.

    Returns
    Type Description
    double4

    The componentwise sign of the input.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023