I press a texture button to start function but for some reason after that every time i press space the function plays aswell

I was testing a dialogue function but then i ran into this bug. The dialogue system works well but the function is called out for no reason everytime i hit space…

here’s the script

func _on_texture_button_pressed():
print(“pressed”)
$CharacterBody2D/Base.PlayText(Dialogues[1],false)

This does not happen until i have clicked the texture button, but once i have clicked on it everytime i hit space the dialogue function starts and no inputs have been given inside the dialogue function just in case if you are wondering. Please help

If you click a Button, it will gain focus – allowing the user, amongst other things, to select adjacent UI nodes via their keyboard. A button can also be pressed by using any input event associated with the ui_accept input action. By default, that includes the Space key. So you could just modify the input action, but it sounds like what you actually want to do, is to change the focus_mode property of the button: Select the button in the scene tree, then search the inspector for “Focus > Mode” and set it to “None”.

1 Like

Thanks that was exactly what i needed and i got to learn about focus_mode property as well. I’m extremely grateful.

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