-
-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Input.parse_input_event does not work in version 4.2.1 #87692
Description
Tested versions
It worked in version 4.1.1, but in version 4.2.1 it does not work
System information
Window 10 - Godot v4.2.1 - Mobile
Issue description
Input.parse_input_event does not work in version 4.2.1, but it does work in version 4.1.1
Here I have a godot project that when pressing the button should execute the action 'ui_left'
It works perfectly in godot 4.1.1 but when I try to use it in godot 4.2.1 it doesn't work
Try to use Input.action_press() but it doesn't give the desired results as this method keeps running infinitely
Code
extends Node2D
@export var input_pressed:String = ''
func _process(delta: float) -> void:
if Input.is_action_pressed("ui_left", true):
print('The button left is being pressed')
pass
func _on_button_button_down() -> void:
# This way works correctly in godot 4.1.1, but in godot 4.2.1 it doesn't work
input_parse_input_event(true)
# If I use this way, is_action_pressed is still executed even if I change the value of 'pressed' to false
#input_action_press(true)
pass
func _on_button_button_up() -> void:
# This way works correctly in godot 4.1.1, but in godot 4.2.1 it doesn't work
input_parse_input_event(false)
# If I use this way, is_action_pressed is still executed even if I change the value of 'pressed' to false
#input_action_press(false)
pass
func input_parse_input_event(is_pressed=true):
var e = InputEventAction.new()
e.action = input_pressed
e.pressed = is_pressed
Input.parse_input_event(e)
print(e)
pass
func input_action_press(is_pressed=true):
var e = InputEventAction.new()
e.action = input_pressed
e.pressed = is_pressed
Input.action_press(e.action)
print(e)
pass
Don't forget to add ui_left in the editor variable if you use this code
Steps to reproduce
Use godot 4.1.1 to see correct operation
Run the current scene
Press the button that appears
You will see a message displayed while the button is being pressed
Then use godot 4.2.1
Run the current scene
Press the button that appears
The message indicating that the button has been pressed will not appear.
Minimal reproduction project (MRP)
Godot Error Input Button 4.1.1.zip
Example
Use godot 4.1.1 to see correct operation
Run the current scene
Press the button that appears
You will see a message displayed while the button is being pressed
'The button left is being pressed'
Then use godot 4.2.1
Run the current scene
Press the button that appears
The message indicating that the button has been pressed will not appear.
'The button left is being pressed'