Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Ceilingdoor | |
Old Version | Published before Godot 3 was released. |
So, my code is this:
func _unhandled_input(ev):
if ev.pressed:
d += 1
get_node("Label").set_text(str(d))
pass
This makes the label show number 2. As far as I can tell, this should be 1 as ev.pressed triggers only once, when there’s a “pressed” event happening. Looks like it triggers twice for some reason. Am I mistaken?
EDIT: Now I’m really confused. If I rewrite the code line with ev.pressed like 3 or 4 times, it triggers once, if I do that again, it triggers twice. No code is modified, I just erase the code and rewrite it the same way.
event.is_echo
is true by any chance?
Bojidar Marinov | 2016-03-17 18:23
I tried using !ev.is_echo, that didn’t have any effect. The thing is that the code worked great but it just stopped working all of a sudden with no reason.
Ceilingdoor | 2016-03-18 06:15
What if you use _input
instead?
Bojidar Marinov | 2016-03-18 08:57