Topic was automatically imported from the old Question2Answer platform.
Asked By
Andrea
Hello,
I have a project with a big “Start New Game” button at the bottom of the screen.
Now, during debug I wrote a piece of code so that pressing space would do the same effect as pressing the new game button.
However I don´t need it anymore (and I actually need the spacebar for pausing the game), but i have a big problem:
even if the code is deleted, if I press the spacebar godot starts a new game, as the code was still there somewhere!
Is it a bug? Have a I turned on some magic option?
If that’s the case then your Button must have been focused (which gives it a little blue rectangular outline around it).
Also, take a look at Input Map(Project > Project Settings > Input Map), you can see that the ui_select action is mapped to the Space key. Because of this, any key or button mapped to ui_select when pressed will be able to press the focused button.
Thank you very much! The button was indeed set as “enable focus: all”
And thanks for introducing me to the input map!