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

Is Touching#

Input / Is Touching

  • Can Read

  • Cannot Write

Description#

Returns true if at least one finger is touching the screen

Code#

using System;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Get]

    [Title("Is Touching")]
    [Category("Input/Is Touching")]

    [Description("Returns true if at least one finger is touching the screen")]
    [Image(typeof(IconTouch), ColorTheme.Type.Blue)]

    [Keywords("Screen", "Mobile", "Tap", "Finger", "Press")]

    [Serializable]
    public class TypeBoolInputTouching : TypeBool
    {
        public override bool Get(Args args)
        {
            Touchscreen touchscreen = Touchscreen.current;
            if (touchscreen == null) return false;

            foreach (TouchControl touch in touchscreen.touches)
            {
                if (touch.press.isPressed) return true;
            }

            return false;
        }

        public override string ToString()
        {
            return "Touching Screen";
        }

        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.