docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class LayerMaskExtensions

    Extension methods for LayerMask structs.

    Inheritance
    object
    LayerMaskExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.XR.CoreUtils
    Assembly: Unity.XR.CoreUtils.dll
    Syntax
    public static class LayerMaskExtensions

    Methods

    Contains(LayerMask, int)

    Checks whether a layer is in a LayerMask.

    Declaration
    public static bool Contains(this LayerMask mask, int layer)
    Parameters
    Type Name Description
    LayerMask mask

    The layer mask.

    int layer

    The layer index to check for.

    Returns
    Type Description
    bool

    True if the specified layer is in this mask.

    GetFirstLayerIndex(LayerMask)

    Gets the index of the first enabled layer in this layerMask.

    Declaration
    public static int GetFirstLayerIndex(this LayerMask layerMask)
    Parameters
    Type Name Description
    LayerMask layerMask

    The layer mask.

    Returns
    Type Description
    int

    The index of the first enabled layer.

    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)