Gamepad (button pressed)

Hi. :heart_hands:

When I hold down the :arrow_forward: event.gamepad.dpad.left button, the event is sent only once.

Is this expected behavior or should it be sent constantly?
How to catch the event of a pressed button?

-I don’t have a real gamepad, I’m testing from the TV remote control.


Perhaps you should read the source code to get more info. I can’t find dounment or api of gamepad.

And I think this is the right way to use gamepad event.

import { __private, _decorator, Component, EventGamepad, Input, input, Node } from 'cc';
const { ccclass, property } = _decorator;

export class GamePadTest extends Component {
    start() {
        input.on(Input.EventType.GAMEPAD_INPUT, this.onGamePadInput, this)
        input.on(Input.EventType.GAMEPAD_CHANGE, this.onGamePadChange, this)

    private device0: __private._pal_input__GamepadInputDevice;

    update(deltaTime: number) {
        if(this.device0 && this.device0.connected){

    public onGamePadInput(e: EventGamepad){

    public onGamePadChange(e: EventGamepad){
        console.log("gamepad change id:" + e.gamepad.deviceId);
        this.device0 = e.gamepad;

    public left(){
        console.log("pressing left");

I was just able to return to the project. I’ll test this method now. Thank you. As I understand it, you suggest using GAMEPAD_CHANGE and saving it to a non-local variable.

I used GAMEPAD_INPUT in my project.

I’ll be back later with the test result.