InputEventKey.IsActionaPressed("action") emitted twice

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By steffan99
public override void _UnhandledKeyInput(InputEventKey @event)
{
    InputEventKey inputEventkey = @event;

    if ( inputEventkey.IsActionPressed("reload") )
    {
        GD.Print("Reload");
        reload = true;
    }

    if ( inputEventkey.IsActionPressed("mode") )
    {
        CycleMode();
    }
    
}

It’s printing reload twice

any ideas?

EDIT: I found the problem. Turns out because my current scene is a child of a Viewport node and i tried to put this code in the viewport to enable object picking and this what causes it. But now i can’t use object picking.

public override void _Input(InputEvent @event)
{
    UnhandledInput(@event);
}
:bust_in_silhouette: Reply From: yrtv

Broken mechanical key switch.
https://tesorotec.com/support/key-chattering/