---
tags:
    - "Layer"
    - "Mask"
    - "Filter"
    - "Physics"
    - "Group"
    - "Is"
---

# In Layer Mask

[Game Object](index.md) / **In Layer Mask**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Returns True if the layer of the Game Object is part of the specified Layer Mask

## Parameters

| Name | Description |
| :--- | :---------- |
| Game Object | The Game Object that is checked |
| Layer Mask | The set of layers the Game Object is expected to belong to |

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("In Layer Mask")]
    [Category("Game Object/In Layer Mask")]

    [Description("Returns True if the layer of the Game Object is part of the specified Layer Mask")]
    [Image(typeof(IconLayers), ColorTheme.Type.TextLight, typeof(BadgeTick))]

    [Parameter("Game Object", "The Game Object that is checked")]
    [Parameter("Layer Mask", "The set of layers the Game Object is expected to belong to")]

    [Keywords("Layer", "Mask", "Filter", "Physics", "Group", "Is")]

    [Serializable]
    public class TypeBoolGameObjectInLayerMask : TypeBool
    {
        [SerializeField] private GetGameObject m_GameObject = new GetGameObject();
        [SerializeField] private LayerMask m_LayerMask = ~0;

        public override bool Get(Args args)
        {
            GameObject gameObject = this.m_GameObject.Get(args);
            if (gameObject == null) return false;

            return (this.m_LayerMask.value & 1 << gameObject.layer) != 0;
        }

        public override string ToString()
        {
            return $"{this.m_GameObject} in Layer Mask";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}

```

