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

Keyboard WASD XZ#

Input / Keyboard WASD XZ

  • Can Read

  • Cannot Write

Description#

Returns the value of the W, A, S and D keys on the X and Z axes

Code#

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

namespace VisualScript.Runtime
{
    [Get]

    [Title("Keyboard WASD XZ")]
    [Category("Input/Keyboard WASD XZ")]

    [Description("Returns the value of the W, A, S and D keys on the X and Z axes")]
    [Image(typeof(IconWASD), ColorTheme.Type.Blue)]

    [Keywords("Move", "Keys", "Plane", "Ground")]

    [Serializable]
    public class TypeVector3InputKeyboardWASD : TypeVector3
    {
        [NonSerialized] private UnityEngine.InputSystem.InputAction m_InputAction;

        ~TypeVector3InputKeyboardWASD()
        {
            this.m_InputAction?.Disable();
            this.m_InputAction?.Dispose();
        }

        public UnityEngine.InputSystem.InputAction InputAction
        {
            get
            {
                if (this.m_InputAction == null)
                {
                    this.m_InputAction = new UnityEngine.InputSystem.InputAction(
                        "WASD",
                        InputActionType.Value
                    );

                    this.m_InputAction.AddCompositeBinding("2DVector")
                        .With("Up", "<Keyboard>/w")
                        .With("Down", "<Keyboard>/s")
                        .With("Left", "<Keyboard>/a")
                        .With("Right", "<Keyboard>/d");

                    this.m_InputAction.Enable();
                }

                return this.m_InputAction;
            }
        }

        public override Vector3 Get(Args args)
        {
            Vector2 value = this.InputAction?.ReadValue<Vector2>() ?? default;
            return new Vector3(value.x, 0f, value.y);
        }

        public override string ToString()
        {
            return "Keyboard WASD XZ";
        }

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