Hi,
I faced this really strange challenge with gdscript. I don't know if I really can't see the problem in this simple code or this is some kind of bug.
Here's the code where I want to increase the counter by pressing enter and then reducing it by pressing the button. Strange thing happens when I press enter two or three times, then reduce the counter by pressing the button. When I press enter once again, it runs the button function automatically after it. The counter gets up by 1 and drops by 1 just by pressing enter. I can't see any connection between the two, but maybe it's just me. Hopefully someone can try the code and help me understand what is going on here.
extends Node2D
var counter = 0
func _input(event):
if event.is_action_released("ui_accept"):
counter = counter + 1
print("Space pressed")
print(counter)
func _on_Button_pressed():
counter = counter - 1
print("Button pressed")
print(counter)
UPDATE: Using different signal func _on_Button_gui_input(event)
with the same code works as intended, but I still don't see the real reason why pressed
signal is causing the problem in the first place.