Godot Version
4.5.1 (Linux)
Question
OS: Fedora Linux Silverblue (GNOME)
I am experiencing inconsistent input behavior in Godot 4 where a key release event is triggered almost instantaneously after a press event (sub-millisecond), or with delays. This leads to unexpected movement in character or almost non existent movement.
Here are some logs
[Pressed] Key: E | Delta: 417745 µs (417.745000 ms)
[Release] Key: E | Delta: 66993 µs (66.993000 ms)[Pressed] Key: E | Delta: 417965 µs (417.965000 ms)
[Release] Key: E | Delta: 67054 µs (67.054000 ms)[Pressed] Key: E | Delta: 1548587 µs (1548.587000 ms)
[Release] Key: E | Delta: 77 µs (0.077000 ms)[Pressed] Key: E | Delta: 462165 µs (462.165000 ms)
[Release] Key: E | Delta: 61965 µs (61.965000 ms)[Pressed] Key: Alt | Delta: 1210265 µs (1210.265000 ms)
[Release] Key: Alt | Delta: 200000 µs (200.000000 ms)
I tried pressing at fast, consistent intervals, and mostly it sits around 60 ms. However, sometimes it has values of 77 microseconds (too fast for a human hand) or 200 milliseconds.
Thinking it was a hardware or driver issue, I checked these values with a Linux utility called libinput, which I can use to see the time difference between pressing and releasing buttons.
They were normal; those anomalies of < 100 µs or 200 ms were not observed, meaning it is mainly a Godot issue.
I also tried running with –display-driver wayland , but the behavior remained the same. This is the code I used to measure the deltas:
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey and not event.is_echo():
var current_time = Time.get_ticks_usec()
var delta_input = current_time - last_event_time
var action_type = "Pressed" if event.pressed else "Release"
print("[%s] Key: %s | Delta: %d µs (%f ms)" % [
action_type,
event.as_text(),
delta_input,
delta_input / 1000.0
])
last_event_time = current_time