Pause triggers with any input

Godot Version

4.4.1

Question

Hi! Adding this code triggers pause on any key/mouse click instead of “P”. What’s wrong here?

Hi,

_input is called on any input. Then, in your code, you exit your function (with the return statement) only inside the if event.is_action_pressed("pause") block, which means that all other inputs will not return.

Try adding something like:

if not event.is_action_pressed("pause"):
    return
3 Likes

Thanks again for your help! It worked.

1 Like