How to make the _button_pressed signal run first before the _input function?

Godot Version



here is a part of my code in my project:

#checks if the button was pressed and opens the settings menu (open_settings_menu function also changes the variable settings_opened to true)
func _on_settings_button_pressed():

#checks if the mouse left click was pressed 
func _input(event: InputEvent):
	if event is InputEventMouseButton:
		if event.pressed:
			if event.button_mask == MOUSE_BUTTON_LEFT and text_to_add == "" and settings_opened==false and cutscene_active==false:


When i try to click the button(with left mouse click) on the screen the _input gets executed first which makes it execute process_scene_instructions(). I want process_scene_instructions() to get executed only when the cursor is outside of the button. Is there a clean way to do it?

Thanks in advance.

It’s not possible _input() always runs first. Try with Node._unhandled_input()

More info about the InputEvent system Using InputEvent — Godot Engine (stable) documentation in English

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.