How to ensure parse_input_event triggers is_action_just_pressed?

Godot Version 4.3

Hi,

in my main scene I instantiate a custom ui and a player node.

In my custom ui I use parse_input_event(jump_action) which should be consumed by my player node with is_action_just_pressed().
Unfortunately it does not work, because parse_input_event() apparently keeps the last action as long as some other action was triggered, so is_action_just_pressed() returns true only if previously another or none action was used.

The obvious idea would be to use an idle action after the logic after is_action_just_pressed() was executed, but I would like to know what the best practice in this case is.

I attached a minimal reproducible example in one script, since the described effect already occurs like this.

extends Node2D

func _ready():
InputMap.add_action(“jump”)

func _process(_delta: float) → void:
var action_event = InputEventAction.new()
action_event.action = “jump”
action_event.pressed = true
Input.parse_input_event(action_event)

func _physics_process(_delta: float) → void:
if Input.is_action_just_pressed(“jump”):
print(“Jump was just pressed”)

I kind of solved it.

Instead of:

func _process(_delta: float) → void:
var action_event = InputEventAction.new()
action_event.action = “jump”
action_event.pressed = true
Input.parse_input_event(action_event)

I simply use:

func _process(_delta: float) → void:
Input.action_press(“jump”)
Input.action_release(“jump”)

and this way each time I trigger the command is_action_just_pressed() returns true.

I’m still thankful for replies, since I don’t know if this is best practice, but I like the solution for its minimal and direct implementation.