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

# Is Gamepad Pressed

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

<div class="grid cards" markdown>

* :green_circle: Can Read

* :red_circle: Cannot Write

</div>

## Description

Returns true if the specified Gamepad button is being held down

## Code

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

namespace VisualScript.Runtime
{
    [Get]
    
    [Inline(nameof(m_Button))]
    
    [Title("Is Gamepad Pressed")]
    [Category("Input/Is Gamepad Pressed")]
    
    [Description("Returns true if the specified Gamepad button is being held down")]
    [Image(typeof(IconGamepad), ColorTheme.Type.Blue)]
    
    [Keywords("Button", "Down")]
    
    [Serializable]
    public class TypeBoolInputGamepadPress : TypeBool
    {
        [SerializeField] private GamepadButton m_Button = GamepadButton.South;

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

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

