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

Gamepad DPad#

Input / Gamepad DPad

  • Can Read

  • Cannot Write

Description#

Returns the Vector2 representing the DPad value

Code#

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

namespace VisualScript.Runtime
{
    [Get]
    
    [Title("Gamepad DPad")]
    [Category("Input/Gamepad DPad")]
    
    [Description("Returns the Vector2 representing the DPad value")]
    [Image(typeof(IconGamepadCross), ColorTheme.Type.Blue, typeof(BadgeArrowLeft))]
    
    [Keywords("Directional", "Pad", "Arrows", "Cross")]
    
    [Serializable]
    public class TypeVector2InputGamepadDirectionalPad : TypeVector2
    {
        [NonSerialized] private UnityEngine.InputSystem.InputAction m_InputAction;

        ~TypeVector2InputGamepadDirectionalPad()
        {
            this.m_InputAction?.Disable();
            this.m_InputAction?.Dispose();
        }
        
        private UnityEngine.InputSystem.InputAction InputAction
        {
            get
            {
                if (this.m_InputAction == null)
                {
                    this.m_InputAction = new UnityEngine.InputSystem.InputAction(
                        name: "Gamepad DPad",
                        type: InputActionType.Value,
                        binding: "<Gamepad>/dpad"
                    );
                    
                    this.m_InputAction.Enable();
                }
                
                return this.m_InputAction;
            }
        }

        public override Vector2 Get(Args args)
        {
            return this.InputAction?.ReadValue<Vector2>() ?? default;
        }

        public override string ToString()
        {
            return "Gamepad DPad";
        }

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