Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Input.parse_input_event does not work in version 4.2.1 #87692

Closed
devmark404 opened this issue Jan 29, 2024 · 3 comments
Closed

Input.parse_input_event does not work in version 4.2.1 #87692

devmark404 opened this issue Jan 29, 2024 · 3 comments

Comments

@devmark404
Copy link

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'

@Rubonnek
Copy link
Member

I'm able to reproduce this issue with a custom build from master at 17e7f85 as well.

@rsubtil
Copy link
Contributor

rsubtil commented Jan 29, 2024

Possibly a duplicate of #85984, and #86010 might fix this, could you give it a try?

@Rubonnek
Copy link
Member

Possibly a duplicate of #85984, and #86010 might fix this, could you give it a try?

#86010 fixes this issue as well, and the issue presented in #85984 is virtually the same.

Closing as duplicate of #85984.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants