Godot remembers deleted piece of code??

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: 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?

:bust_in_silhouette: Reply From: Dlean Jeans

I think it’s the UI action keys at work.

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!

Andrea | 2018-02-19 08:04