Disable Input Action#
Input / Disable Input Action
Description#
Disables an Input Action asset with an Action value which allows reading user input
Parameters#
| Name | Description |
|---|---|
| Input Asset | The Input Asset reference and Action name |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Disable Input Action")]
[Image(typeof(IconBoltOutline), ColorTheme.Type.TextLight)]
[Description("Disables an Input Action asset with an Action value which allows reading user input")]
[Category("Input/Disable Input Action")]
[Parameter("Input Asset", "The Input Asset reference and Action name")]
[Keywords("Deactivate", "Inactive")]
[Serializable]
public class InstructionCoreInputDisableAction : Instruction
{
[SerializeField] private InputActionFromAsset m_InputAsset = new InputActionFromAsset();
protected override string GetTitle(GameObject source)
{
string input = TextUtils.ThemeAsConstant(this.m_InputAsset.ToString());
return $"Disable {input}";
}
protected override Awaitable Run(Args args)
{
UnityEngine.InputSystem.InputAction inputAction = this.m_InputAsset.InputAction;
if (inputAction is { enabled: true }) inputAction.Disable();
return Done;
}
}
}