This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I am right now making a menu that pops up mid-game, but that doesn't pause the game. I want the menu to consume all inputs so the player doesn't start moving, but I also want to rely on the focus_neighbors system to make changing the menu easy if I need to add stuff later.

Here's the important bit of code:

func _gui_input(event):
    if event.is_action_pressed("ui_cancel"):

The problem is, acceptevent() comes BEFORE checking for focusneighbors! I want left/right/up/down input to use focus neighbors if able, and if it can't, consume the input so the player doesn't hear the input and start moving. Is there a way to do that?

Godot version 3.5
in Engine by (181 points)

A different option might be to simply wrap your input event processing code in an if block that's aware (via some boolean value) of whether the menu is open or not. If the menu is open, simply don't execute the code that processes the input events you're trying to avoid. Then, when the menu closes, reset the boolean so that the events are processed as normal.

That's a good idea! If there's no way to do the above, I might go with that. But honestly, this feels like something that should be solvable, right? The Control node exists for menus that take control out of the game. That's why unhandledinput exists, after all. It would be self-defeating to having a feature in Control nodes that doesn't respect that need.

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.