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 triggered multiple times on SteamDeck #85933

Closed
MindFlayeR57 opened this issue Dec 8, 2023 · 5 comments
Closed

Input triggered multiple times on SteamDeck #85933

MindFlayeR57 opened this issue Dec 8, 2023 · 5 comments

Comments

@MindFlayeR57
Copy link

Tested versions

4.1.2, 4.1.3, and 4.2 all of them are affected and it would take me forever to test more versions with my download speeds

System information

SteamOS 3.5.7

Issue description

is_action_just_pressed() triggers multiple times on SteamDeck when executed under the _input() function.

Steps to reproduce

  1. Export the attached project and run it on SteamDeck
  2. Switch to the console window
  3. Press A
  4. It will print the amount of times it got triggered by a single press (usually 3-4)

Minimal reproduction project (MRP)

SteamDeck Bug.zip

@Sauermann
Copy link
Contributor

Please try using

func _input(event: InputEvent) -> void:
	if event.is_action_pressed("ui_accept"):
		i += 1
		print(i) # prints the amount of times is_action_just_pressed() got triggered despite the documentation saying it only triggers once per button press

Input.is_action_just_pressed("ui_accept") returns, if in the current frame any event has the "ui_accept" action pressed. So when multiple events are sent in a single frame, each one of them causes an i += 1 in the same frame.

@clayjohn
Copy link
Member

clayjohn commented Dec 8, 2023

This sounds eerily similar to the issue fixed by #76045

@MindFlayeR57
Copy link
Author

Please try using

func _input(event: InputEvent) -> void:
	if event.is_action_pressed("ui_accept"):
		i += 1
		print(i) # prints the amount of times is_action_just_pressed() got triggered despite the documentation saying it only triggers once per button press

Input.is_action_just_pressed("ui_accept") returns, if in the current frame any event has the "ui_accept" action pressed. So when multiple events are sent in a single frame, each one of them causes an i += 1 in the same frame.

It works! Thank you very much!

@akien-mga
Copy link
Member

I'm not sure this is fixed? Is it not a bug in the end?

@Sauermann
Copy link
Contributor

I had a look at the MRP of #76045 and that PR is unrelated to this issue (it has nothing to do with is_action_just_pressed).

This bug report looks more like a duplicate of #80158 and is based on using Input.is_action_just_pressed in an unintended location. The documentation was adjusted accordingly in #80185.

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

5 participants