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

Touch Delta#

Input / Touch Delta

  • Can Read

  • Cannot Write

Description#

Returns delta movement of the specified finger touching the screen

Parameters#

Name Description
Finger The zero based index of the touch. Returns nothing when out of range

Code#

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

namespace VisualScript.Runtime
{
    [Get]

    [Title("Touch Delta")]
    [Category("Input/Touch Delta")]

    [Description("Returns delta movement of the specified finger touching the screen")]
    [Image(typeof(IconTouch), ColorTheme.Type.Blue, typeof(BadgeDelta))]

    [Parameter("Finger", "The zero based index of the touch. Returns nothing when out of range")]

    [Keywords("Screen", "Mobile", "Swipe", "Drag", "Move", "Finger")]

    [Serializable]
    public class TypeVector2InputTouchDelta : TypeVector2
    {
        [SerializeField] private GetInteger m_Finger = new GetInteger(0);

        public override Vector2 Get(Args args)
        {
            Touchscreen touchscreen = Touchscreen.current;
            if (touchscreen == null) return default;

            int finger = this.m_Finger.GetInt(args);
            if (finger < 0 || finger >= touchscreen.touches.Count) return default;

            return touchscreen.touches[finger].delta.ReadValue();
        }

        public override string ToString()
        {
            return $"Touch {this.m_Finger} Delta";
        }

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