Is Any Key Pressed#
Input / Is Any Key Pressed
Can Read
Cannot Write
Description#
Returns true if any Keyboard key is being held down
Code#
using System;
using UnityEngine.InputSystem;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Is Any Key Pressed")]
[Category("Input/Is Any Key Pressed")]
[Description("Returns true if any Keyboard key is being held down")]
[Image(typeof(IconKeyHold), ColorTheme.Type.Blue)]
[Keywords("Button", "Down", "Every", "Some")]
[Serializable]
public class TypeBoolInputKeyboardAnyPress : TypeBool
{
public override bool Get(Args args)
{
Keyboard keyboard = Keyboard.current;
return keyboard != null && keyboard.anyKey.isPressed;
}
public override string ToString()
{
return "Pressing any Key";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}