---
tags:
    - "Button"
    - "Down"
---

# Is Keyboard Pressed

[Input](index.md) / **Is Keyboard Pressed**

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Returns true if the specified Keyboard key is being held down

## Code

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

namespace VisualScript.Runtime
{
    [Get]
    
    [Inline(nameof(m_Key))]
    
    [Title("Is Keyboard Pressed")]
    [Category("Input/Is Keyboard Pressed")]
    
    [Description("Returns true if the specified Keyboard key is being held down")]
    [Image(typeof(IconKey), ColorTheme.Type.Blue)]
    
    [Keywords("Button", "Down")]
    
    [Serializable]
    public class TypeBoolInputKeyboardPress : TypeBool
    {
        [SerializeField] private Key m_Key = Key.Space;

        public override bool Get(Args args)
        {
            return Keyboard.current[this.m_Key].isPressed;
        }

        public override string ToString()
        {
            return $"Pressing {this.m_Key}";
        }
        
        protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
    }
}
```

