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