docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method select

    select(int, int, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static int select(int a, int b, bool c)
    Parameters
    Type Name Description
    int a

    Value to use if c is false.

    int b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    int

    The selection between a and b according to bool c.

    select(int2, int2, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static int2 select(int2 a, int2 b, bool c)
    Parameters
    Type Name Description
    int2 a

    Value to use if c is false.

    int2 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    int2

    The selection between a and b according to bool c.

    select(int3, int3, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static int3 select(int3 a, int3 b, bool c)
    Parameters
    Type Name Description
    int3 a

    Value to use if c is false.

    int3 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    int3

    The selection between a and b according to bool c.

    select(int4, int4, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static int4 select(int4 a, int4 b, bool c)
    Parameters
    Type Name Description
    int4 a

    Value to use if c is false.

    int4 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    int4

    The selection between a and b according to bool c.

    select(int2, int2, bool2)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static int2 select(int2 a, int2 b, bool2 c)
    Parameters
    Type Name Description
    int2 a

    Values to use if c is false.

    int2 b

    Values to use if c is true.

    bool2 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    int2

    The componentwise selection between a and b according to selection mask c.

    select(int3, int3, bool3)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static int3 select(int3 a, int3 b, bool3 c)
    Parameters
    Type Name Description
    int3 a

    Values to use if c is false.

    int3 b

    Values to use if c is true.

    bool3 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    int3

    The componentwise selection between a and b according to selection mask c.

    select(int4, int4, bool4)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static int4 select(int4 a, int4 b, bool4 c)
    Parameters
    Type Name Description
    int4 a

    Values to use if c is false.

    int4 b

    Values to use if c is true.

    bool4 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    int4

    The componentwise selection between a and b according to selection mask c.

    select(uint, uint, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static uint select(uint a, uint b, bool c)
    Parameters
    Type Name Description
    uint a

    Value to use if c is false.

    uint b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    uint

    The selection between a and b according to bool c.

    select(uint2, uint2, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static uint2 select(uint2 a, uint2 b, bool c)
    Parameters
    Type Name Description
    uint2 a

    Value to use if c is false.

    uint2 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    uint2

    The selection between a and b according to bool c.

    select(uint3, uint3, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static uint3 select(uint3 a, uint3 b, bool c)
    Parameters
    Type Name Description
    uint3 a

    Value to use if c is false.

    uint3 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    uint3

    The selection between a and b according to bool c.

    select(uint4, uint4, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static uint4 select(uint4 a, uint4 b, bool c)
    Parameters
    Type Name Description
    uint4 a

    Value to use if c is false.

    uint4 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    uint4

    The selection between a and b according to bool c.

    select(uint2, uint2, bool2)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static uint2 select(uint2 a, uint2 b, bool2 c)
    Parameters
    Type Name Description
    uint2 a

    Values to use if c is false.

    uint2 b

    Values to use if c is true.

    bool2 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    uint2

    The componentwise selection between a and b according to selection mask c.

    select(uint3, uint3, bool3)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static uint3 select(uint3 a, uint3 b, bool3 c)
    Parameters
    Type Name Description
    uint3 a

    Values to use if c is false.

    uint3 b

    Values to use if c is true.

    bool3 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    uint3

    The componentwise selection between a and b according to selection mask c.

    select(uint4, uint4, bool4)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static uint4 select(uint4 a, uint4 b, bool4 c)
    Parameters
    Type Name Description
    uint4 a

    Values to use if c is false.

    uint4 b

    Values to use if c is true.

    bool4 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    uint4

    The componentwise selection between a and b according to selection mask c.

    select(long, long, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static long select(long a, long b, bool c)
    Parameters
    Type Name Description
    long a

    Value to use if c is false.

    long b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    long

    The selection between a and b according to bool c.

    select(ulong, ulong, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static ulong select(ulong a, ulong b, bool c)
    Parameters
    Type Name Description
    ulong a

    Value to use if c is false.

    ulong b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    ulong

    The selection between a and b according to bool c.

    select(float, float, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static float select(float a, float b, bool c)
    Parameters
    Type Name Description
    float a

    Value to use if c is false.

    float b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    float

    The selection between a and b according to bool c.

    select(float2, float2, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static float2 select(float2 a, float2 b, bool c)
    Parameters
    Type Name Description
    float2 a

    Value to use if c is false.

    float2 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    float2

    The selection between a and b according to bool c.

    select(float3, float3, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static float3 select(float3 a, float3 b, bool c)
    Parameters
    Type Name Description
    float3 a

    Value to use if c is false.

    float3 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    float3

    The selection between a and b according to bool c.

    select(float4, float4, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static float4 select(float4 a, float4 b, bool c)
    Parameters
    Type Name Description
    float4 a

    Value to use if c is false.

    float4 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    float4

    The selection between a and b according to bool c.

    select(float2, float2, bool2)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static float2 select(float2 a, float2 b, bool2 c)
    Parameters
    Type Name Description
    float2 a

    Values to use if c is false.

    float2 b

    Values to use if c is true.

    bool2 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    float2

    The componentwise selection between a and b according to selection mask c.

    select(float3, float3, bool3)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static float3 select(float3 a, float3 b, bool3 c)
    Parameters
    Type Name Description
    float3 a

    Values to use if c is false.

    float3 b

    Values to use if c is true.

    bool3 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    float3

    The componentwise selection between a and b according to selection mask c.

    select(float4, float4, bool4)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static float4 select(float4 a, float4 b, bool4 c)
    Parameters
    Type Name Description
    float4 a

    Values to use if c is false.

    float4 b

    Values to use if c is true.

    bool4 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    float4

    The componentwise selection between a and b according to selection mask c.

    select(double, double, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static double select(double a, double b, bool c)
    Parameters
    Type Name Description
    double a

    Value to use if c is false.

    double b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    double

    The selection between a and b according to bool c.

    select(double2, double2, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static double2 select(double2 a, double2 b, bool c)
    Parameters
    Type Name Description
    double2 a

    Value to use if c is false.

    double2 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    double2

    The selection between a and b according to bool c.

    select(double3, double3, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static double3 select(double3 a, double3 b, bool c)
    Parameters
    Type Name Description
    double3 a

    Value to use if c is false.

    double3 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    double3

    The selection between a and b according to bool c.

    select(double4, double4, bool)

    Returns b if c is true, a otherwise.

    Declaration
    public static double4 select(double4 a, double4 b, bool c)
    Parameters
    Type Name Description
    double4 a

    Value to use if c is false.

    double4 b

    Value to use if c is true.

    bool c

    Bool value to choose between a and b.

    Returns
    Type Description
    double4

    The selection between a and b according to bool c.

    select(double2, double2, bool2)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static double2 select(double2 a, double2 b, bool2 c)
    Parameters
    Type Name Description
    double2 a

    Values to use if c is false.

    double2 b

    Values to use if c is true.

    bool2 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    double2

    The componentwise selection between a and b according to selection mask c.

    select(double3, double3, bool3)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static double3 select(double3 a, double3 b, bool3 c)
    Parameters
    Type Name Description
    double3 a

    Values to use if c is false.

    double3 b

    Values to use if c is true.

    bool3 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    double3

    The componentwise selection between a and b according to selection mask c.

    select(double4, double4, bool4)

    Returns a componentwise selection between two double4 vectors a and b based on a bool4 selection mask c. Per component, the component from b is selected when c is true, otherwise the component from a is selected.

    Declaration
    public static double4 select(double4 a, double4 b, bool4 c)
    Parameters
    Type Name Description
    double4 a

    Values to use if c is false.

    double4 b

    Values to use if c is true.

    bool4 c

    Selection mask to choose between a and b.

    Returns
    Type Description
    double4

    The componentwise selection between a and b according to selection mask c.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)