Documentation index for AI agents (llms.txt) A Markdown version of every page is available: request the page's source under /docs/, follow the "alternate" link in this page's head, or start from /llms.txt.
Visual Script logo Manual

In Layer Mask#

Game Object / In Layer Mask

  • Can Read

  • Cannot Write

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#

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;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.