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

On Input Action Start#

Input / Input Actions / On Input Action Start

Description#

Executes when an Input Action raises the Started event

Code#

using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("On Input Action Start")]
    [Image(typeof(IconBoltOutline), ColorTheme.Type.Teal, typeof(BadgeArrowDown))]
    
    [Description("Executes when an Input Action raises the Started event")]
    [Category("Input/Input Actions/On Input Start")]
    
    [Keywords("System")]

    [Serializable]
    public class TriggerCoreInputActionStart : Trigger
    {
        // EXPOSED MEMBERS: -----------------------------------------------------------------------

        [SerializeField] private InputActionFromAsset m_InputAction = new InputActionFromAsset();
        
        // PROPERTIES: ----------------------------------------------------------------------------

        protected override string GetTitle(GameObject source) => $"{this.m_InputAction} Start";

        // OVERRIDE METHODS: ----------------------------------------------------------------------

        public override void OnEnable()
        {
            base.OnEnable();
            
            UnityEngine.InputSystem.InputAction inputAction = this.m_InputAction.InputAction;
            if (inputAction != null) inputAction.started += this.OnInputCall;
        }

        public override void OnDisable()
        {
            base.OnDisable();
            
            UnityEngine.InputSystem.InputAction inputAction = this.m_InputAction.InputAction;
            if (inputAction != null) inputAction.started -= this.OnInputCall;
        }

        private void OnInputCall(UnityEngine.InputSystem.InputAction.CallbackContext context)
        {
            using Args args = Args.Get(this.Component, this.Component);
            this.Run(args);
        }
    }
}
Visual Script logoVisual Script © Catsoft Works 2026. All rights reserved.