The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+1 vote

Hello there.

I am running my HTML5 game on a pretty strange Android-based TV-box device. This device has a remote control with arrows and OK button. So, using arrows I can normally move my focus from button to button in UI. But OK doesn't work at all. It does not trigger ui_accept event. It has Unknown scancode in fact.

Fortunately, I can catch this OK button in JavaScript (in browser this button normally recognizes as Enter). So, I want to solve it using JavaScript interoperability: check from Godot if OK button was pressed and then simulate exactly ui_accept event.

How can I do this? I use C#.

Input.ActionPress("ui_accept") doesn't work. And ActionRelease too, as well as its combination.

Godot version 3.4
in Engine by (15 points)

Unfortunately, it doesn't work.

Input.ParseInputEvent(new InputEventAction{ Action = "ui_accept", Pressed = true });
GD.Print("Input event");

I see Input event in the console, but current focused button isn't pressed.

Try adding an _unhandled_input() function to a node to see if the ui_accept input is getting marked as handled in another node preventing it from propagating to your button. For kicks I would also write the Input.parse_input_event() in a gdscript script just to make sure it's not some weird c# bug.

I've solved it in a different way. I just recursively find focused button in tree and emit Press signal on it.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.