You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the _process or _physics_process functions, actions are not being properly recognized by Input.is_action_pressed when a modifier key is released, even when exact_match is true.
Consider two keyboard actions, "walk" and "run", which are both bound to the right arrow, but the latter of which uses the Shift key as a modifier. Pressing shift-right will be recognized as "run," but upon releasing the modifier key, the action continues to be recognized as "run" rather than being interpreted as "walk".
if I give the "run" input, then release the shift key, it continues to report the "run" action as matching even though it should instead be the "walk" action.
Strangely, this happens only if the modified action is tested first. The following code works as expected, where "walk" is the unmodified action and "run" is the modified one:
One would expect these two functions to have the same behavior, but they don't.
Note that the _input function and its InputEvent.is_action work as expected, correctly distinguishing between the two states. That is, when running, if releasing the shift key, the input is then recognized as "walk".
Steps to reproduce
Create two keyboard input actions that are different only in that one takes a modifier key (e.g. shift)
In the _process function, use Input.is_action_pressed to monitor the state of the input.
See that the unmodified action is recognized, then pressing the modifier makes the modified action recognized, but releasing the modifier does not revert back to recognizing the unmodified action
Minimal reproduction project (MRP)
When running the example,
press right to recognize the "walk" action
then press shift also to recognize the "run" action
then release shift, keeping right held down, and see that it stays "run" rather than reverting to "walk"
The example also illustrates how this behavior is different from the _input function, which correctly distinguishes between "run" and "walk" using the is_action function.
Tested versions
System information
Godot v4.3.stable - Ubuntu 24.04.1 LTS 24.04 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1070 (nvidia; 535.183.01) - Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz (12 Threads)
Issue description
In the
_process
or_physics_process
functions, actions are not being properly recognized byInput.is_action_pressed
when a modifier key is released, even whenexact_match
is true.Consider two keyboard actions, "walk" and "run", which are both bound to the right arrow, but the latter of which uses the Shift key as a modifier. Pressing shift-right will be recognized as "run," but upon releasing the modifier key, the action continues to be recognized as "run" rather than being interpreted as "walk".
That is, given code like this:
if I give the "run" input, then release the shift key, it continues to report the "run" action as matching even though it should instead be the "walk" action.
Strangely, this happens only if the modified action is tested first. The following code works as expected, where "walk" is the unmodified action and "run" is the modified one:
One would expect these two functions to have the same behavior, but they don't.
Note that the
_input
function and itsInputEvent.is_action
work as expected, correctly distinguishing between the two states. That is, when running, if releasing the shift key, the input is then recognized as "walk".Steps to reproduce
_process
function, useInput.is_action_pressed
to monitor the state of the input.Minimal reproduction project (MRP)
When running the example,
The example also illustrates how this behavior is different from the
_input
function, which correctly distinguishes between "run" and "walk" using theis_action
function.example.zip
The text was updated successfully, but these errors were encountered: